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
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