[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Map logical operator across varlist?
On Jan 17, 2007, at 2:01 PM, Joel J. Adamson wrote:
I want to list a set of variables, only if an observation is not
missing for the variables in question. We usually handle this by
constructing a small logical expression:
l med1 med2 if (med1~=.|med2~=.)
However, if I have six, or a hundred "med" variables (med*), it
would be easier (less error-prone) to type:
l med* if |(med*~=.)
Where the "|" before the "(" maps the operation onto the expanded
list of variables.
egen foo = rownonmiss(med*), [strok]
li med* if foo
where the -strok- option is necessary if one or more vars are of type
string.
-- Phil
*
* 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/