Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65574

"inlist" - expression too long

$
0
0
I've just received the error message "expression too long" when trying to run an "inlist" command that involves a long list of about 1000 numerals, as follows:

gen newvar = 0
foreach var of varlist var1-var18 {
replace newvar = 1 if inlist(`var',1000,1011,1022,1030,1041,1062, etc...very long list.......)
}

Could anyone please help with a more appropriate code to achieve this?

I wonder if a good way would be to call up a dataset which contains the long list of values 1000,1011,1022 etc.

Thanks for any thoughts


Viewing all articles
Browse latest Browse all 65574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>