Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Simplifying multiple cases of the if command


From   "sanja_lutzeyer@ncsu.edu" <slutzey@ncsu.edu>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index