I don't know which FAQ you are referring to.
It might be
http://www.stata.com/support/faqs/data/selectid.html
which points to
http://www.stata.com/support/faqs/data/characteristics.html
which suggests a solution based on -merge-. On
the information provided, that sounds like the nicest
solution.
The statement that -inlist()-
"doesn't like it when one of the arguments in the list doesn't exist"
is in my experience false. And in principle I don't believe it!
My guess is that you are getting mixed up between literal
strings and names of string variables.
. sysuse auto
(1978 Automobile Data)
. l make if inlist(word(make,1), "Ford", "Reagan", "Clinton", "Bush", "any one else")
+--------------+
| make |
|--------------|
24. | Ford Fiesta |
25. | Ford Mustang |
+--------------+
Nick
[email protected]
Danielle H. Ferry
> Is there something like inlist which does not require that
> all arguments
> exist? I would like to keep observations where varname = a or
> b or c or d or
> ... But it could be that varname never takes the value of d.
> Another issue is
> that my list of arguments is v. long (~145), so a simple or
> statement is not
> possible. I found a stata faq that suggested using inlist,
> but this doesn't
> like it when one of the arguments in the list doesn't exist,
> and my varname is
> a string, so I'd have to write many of these inlist
> statements (b/c the limit
> is 10).
*
* 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/