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

st: Re: selecting a range


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: selecting a range
Date   Thu, 20 May 2004 06:58:31 -0400

list studyno age if inlist(x,0,6,7,9,500)

Michael Blasnik
michael.blasnik@verizon.net


----- Original Message ----- 
From: "Rapson, Tracey" <Tracey.Rapson@isd.csa.scot.nhs.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, May 20, 2004 6:37 AM
Subject: st: selecting a range


> Hi,
> I would like to know if there is an easy way of selecting a range of data
> from a dataset. For example, I would like to list the study numbers and
age
> of people in my dataset who have the values 0, 6 , 7 , 9 or 500 for a
> particular variable, x.
>
> At the moment I write it out like this:
> list studyno age if x==0 | x==6 | x ==7 | x==9 | x==500
>
> In sas, one could write "not in(0,6,7,9,500)"
> or in spss, ~=range(x,0,6,7,9,500) (or something similar, can't quite
> remember!)
>
> but I cannot find a simpler method in Stata.
>
> Many thanks
> Tracey
> _________________________________________________________________
> Common Services Agency Disclaimer
>
> The information contained in this message may be confidential or
> legally privileged and is intended for the addressee only. If you have
> received this message in error or there are any problems please notify the
> originator immediately. The unauthorised use, disclosure, copying or
> alteration of this message is strictly forbidden.
> _________________________________________________________________
>
> *
> *   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/


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