Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Collapsing 44 variables to give out mean and sd for every varisble
From
Jeph Herrin <[email protected]>
To
[email protected]
Subject
Re: st: Collapsing 44 variables to give out mean and sd for every varisble
Date
Sun, 02 Mar 2014 15:54:29 -0500
I usually do something like this:
local varlist var1 var2 var3 ....
foreach V in `varlist' {
local meanlist `meanlist' m`V'=`V'
local sdlist `sdlist' sd`V'=`V'
}
collapse (mean) `meanlist' (sd) `sdlist'
hth,
Jeph
On 3/2/2014 3:18 PM, lars Folkestad wrote:
Dear list
I want to collapse my data to get the mean and sd from 34 variables.
I am currently ripping my hair out going:
collapse (mean) var1=var1 (sd) var1sd=var1 (mean) var2=var2 (sd) var2sd=var2 ...
But is there an easier way? The variables are i two categories r_var_name and t_var_name but other than that they are unik var names.
Lars Folkestad
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/