Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: How can I count the number of variables that meet a certain condition per observation?
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: How can I count the number of variables that meet a certain condition per observation?
Date
Sat, 3 Dec 2011 13:18:57 +0100
Phillip "would like to count for each observation the number of
variables that meet a certain condition, say var*==2."
The very first function in -help egen- is -anycount()- and is described as:
"It returns the number of variables in varlist for which values are
equal to any integer value in a supplied numlist. [...] Also see
anyvalue(varname) and anymatch(varlist)."
However, I am not sure I am getting the problem, because
"[...] computing the sum across variables (for each observation) ONLY
for those variables with values greater than 1"
to me means something comletely different and is not at all
"[...] alternatively, [...]"
to
"the number of variables with values greater than 1 per observation"
Best
Daniel
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/