Hi,
I would like to order variables after a reshape in descending order based on sys_tot. To do this, I used rank. The reshape is not working and giving the following error:
Error when values converted to variable names. Try encoding rank and setting original to label. I would like the encoded labels of sys_id to be the variable labels of rank after the reshape. I tried using labmask and I got the error below.
Code:
egen rank = rank (sys_tot), field //generate rank for sys tot greatest to least
tostring rank, replace
//labmask rank, values(sys_id) // error: sys_id not constant within groups of rank
supershape wide d_, i(mdc mdc_desc) j(rank) labels(sys_id) //mdc long; provider wide
Please advice.
Thank you!
Related Posts with How to order variables in descending order based on a row total with variable labels from another variable
Break in consecutive values to identify groupsSuppose I have a dataset like this: clear set obs 20 gen x = 1 gen id = 1 in 1/10 replace id = …
Meta Command for prevalencesI'm trying to run a meta-analysis using the metan command for a rate of the progression outcome vari…
Multilevel regresion code doubtHi all, I have date of 100 employees per company, for several companies. I would like to perform a …
Tabout and Fre suddenly not working?For some reason when I export frequency tables to excel and/or word (as .csv or .rtf files), they ar…
Keep a group of observations if one record meets a certain conditionHi All, Here's an example of the sort of dataset that I'm working with: clear input studyid edvisi…
Subscribe to:
Post Comments (Atom)
0 Response to How to order variables in descending order based on a row total with variable labels from another variable
Post a Comment