Bookmark and Share

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: Simplifying multiple cases of the if command


From   "[email protected]" <[email protected]>
To   [email protected]
Subject   st: Simplifying multiple cases of the if command
Date   Fri, 16 Nov 2012 12:33:50 -0500

Hi all.
This might be a very easy question, but if I have a number of things
that have to hold when generating a variable, is there a way to
simplify the following?

generate variable if news== 1 | news == 3 | news ==5

to something like
generate variable if news == 1 | 3 | 5? I tried this

Thanks!
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index