[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: selecting a range
The easiest is
... if inlist(x, 0, 6, 7, 9, 500)
You say "not" in some cases but not others.
... if !inlist(x, 0, 6, 7, 9, 500)
negates that condition. (It's going to
select any missings on x.)
It's worth a scan of the on-line help
on functions to see which would be useful
in your work.
In related territory there are at least
> 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
> but I cannot find a simpler method in Stata.
* For searches and help try: