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

RE: st: retrun code 130. why constraint so low?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: retrun code 130. why constraint so low?
Date   Mon, 9 Sep 2002 18:40:56 +0100

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 
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