Ulrich Kohler
>
> Did you tried the inlist() function? This function makes
> complicated
> if-conditions very often much shorter and may help you to
> circumvent your
> proplem. For example, instead of typing
>
> gen newvar = 1 if oldvar==1 & oldvar==7 & oldvar==13 &
> oldvar==15 & oldvar==27
>
> you can type
>
> gen newvar = 1 if inlist(oldvar,1,7,13,15,27)
>
> Also consider the inrange()-function. See -help functions-
> for more on
> inlist() and inrange()
>
Just to fix a typo here.
-inlist()- tests if the first argument
is _any_ of the remaining arguments. It is
thus equivalent to multiple use of |, not of &.
Nick
[email protected]
*
* 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/