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]
st: loop with egen
From
Nahla Betelmal <[email protected]>
To
[email protected]
Subject
st: loop with egen
Date
Fri, 8 Feb 2013 13:29:52 +0000
Dear Statalist,
I am trying to generate the mean and standard deviation for more than
30 variables. I tried to do that using the following loop
foreach v of var {
egen mean = mean(`v')
egen sd = sd(`v')
}
however, it only generate the mean and standard deviation for the
first variable only.
I got this message :mean already defined
r(110);
what should I add to the loop , so it can generate the mean and
standard deviation for each variable in separate column?
Many thanks
Nahla
*
* 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/