Herve Stolowy wrote:
I have about 50 variables. I get the mean with -univar- [redacted ]
or -summarize-.
univar var1 ... var50
summarize var1 ... var50
Is there a way to rank (descending order) the variables by there mean?
--------------------------------------------------------------------------------
Try the following.
Joseph Coveney
clear
set more off
set seed `=date("2007-01-27", "ymd")'
set obs 100
forvalues i = 1/50 {
generate float var`i' = `i' + uniform()
}
*
* Begin here
*
collapse (mean) var*
generate byte row = 1
reshape long var, i(row) j(variable_nr)
egen rank = rank(var), field // track or field
*
* Done
*
gsort -var
list , noobs abbreviate(15)
exit
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/