Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: "too many elements in numlist": -egen anycount(), values(numlist)-


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: "too many elements in numlist": -egen anycount(), values(numlist)-
Date   Wed, 12 Aug 2009 21:00:43 +0100

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index