Your numlist would have had nearly 200,000 elements. The calculation
would have been very slow anyway!
The answer is yes!
gen mysum = 0
foreach v of local varlist {
replace mysum = mysum + (`v' > 9700 & `v' < . & `v' < 200710)
}
Also check out -inrange()-.
Nick
[email protected]
Mandy fu
When I use the following command to count how many variables in the
varlist is greater than 9700 and less than 200710, I got an error
message that says the numlist has too many elements:
------------------------------
. egen newvar=anycount(varlist), values(9700/200710)
----values() invalid -- invalid numlist has too many elements
r(123);
--------------------------
I was wondering if there's any alternative way to get the total numebr
of variables in the varlist whose values are in a large range such as
(9700,200710).
*
* 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/