[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: xcollapse, multiple ifs
Is there any way to have different "if statements" with the command xcollapse?
I tried to do
xcollapse (mean) m1 = x if year > 1970 & year <1980 (mean) m2 = x if
year > 1980 & year < 1990...
but I got an error message.
One way to get around this problem is to just define new variables so
x1 = x if year > 1970 & year < 1980
x2 = x if year > 1980 & year < 1990
and then
xcollapse (mean) x1 x2...
but was wondering if there was a better way of doing this.
Thank you.
Richard
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/