Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: generate variable


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: generate variable
Date   Sat, 27 May 2006 17:47:13 +0100

I think you need two & operators. No logical operator 
can be given implicitly. Parenthesising aggressively
would do no harm either. 

So, for example, there is no Stata equivalent 
of 

a <= x <= b 

except (a <= x) & (x <= b) 

Nick 
[email protected] 

peter harper
  
> I am trying to code in stata the number of people with work 
> limiting disability. I have two variables in my dataset 
> relating to disability.
>  
>  
> When I issued
>  
> .ge disabledwklim=.
>  
> .replace disabledwklim=1 if e6a==1&e6b==1
> 997 changes made
>  
> (this is correct). But when I issued the following command I 
> cannot obtain "18825 changes made total", that is from 
> e6a==2+(e6a==1-e6b==2)= 17,174+1651 which is =18825
>  
> .replace disabledwklim=2 if e6a==2&e6a==1-e6b==2
> (no changes made)
>  
> I would be grateful if anyone would let me know the correct 
> command for the second replace above.

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index