Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: xcollapse, multiple ifs


From   richard boylan <[email protected]>
To   [email protected]
Subject   st: xcollapse, multiple ifs
Date   Fri, 27 Mar 2009 08:55:34 -0500

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index