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]

Re: st: Simplifying multiple cases of the if command


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

look at the inlist function (-h inlist-)

Rich

On 11/16/12 12:33 PM, [email protected] wrote:
> 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