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

st: RE: Re: replacing variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: replacing variables
Date   Tue, 28 Jan 2003 20:51:59 -0000

Radu Ban
> 
> use _inrange_
> 
> hsgrad = inrange(grade, 9, 12)

Jean Roth
> 
> Is it possible to shorten the 'if' statement in the replace below
> and still retain the upper and lower bounds?
> 
> replace hsgrad = 1 if grade>=9 & grade<=12
> 

Note that this is not exactly equivalent. 

The difference is between a result which is 
1 or 0 and one which is 1 or missing. 

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