Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: STATA Vs. SAS


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: STATA Vs. SAS
Date   Wed, 27 Nov 2002 21:25:09 -0000

Fred Wolfe
> 
> Practically, if the if condition is complicated one often 
> makes a new 
> variable or local macro, as in
> 
> gen newvar = cond(x == 1 & age >27 & date >mdy(01,01,2002),1,0)
> 
> then just using - if newvar- for the if condition.
> 

In turn, it's perhaps worth pointing that this example is 
equivalent to 

gen newvar = x == 1 & age >27 & date >mdy(01,01,2002)

That is 

cond(true_or_false_condition,1,0)

is equivalent to 

true_or_false_condition 

Nick 
n.j.cox@durham.ac.uk 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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