Hi everyone- I am a new user here.
I am running into a problem.
STATA does not allow to use more than 10 arguments for strings- and says expression too long. However, I have more than 10.
For example- there are multiple ICD9 codes for myocarditis, and to get all the patients with myocarditis, I would need to get all those ICD codes. a nd then I place them as binary values 1=present and 0=absence of this diagnosis.
If I make two variables like myocarditis1 and myocarditis 2 with less than 10 arguments each so that STATA wont give error message, it will make a new column for each variable : myocarditis1 with 0 and 1, and similarly a new column with 0 and 1 for myocarditis 2. How can I combine those two variable columns to get a single column? The code I use to generate myocarditis variable is . 1/25 is because there are 25 columns for the codes for diagnosis from DX1 to DX25.
gen myocarditis1=0
forvalues j=1/25{
replace myocarditis1=1 if inlist(DX`j', "4290", "42299", "42290", "07423","07420", "03640", "03643", "4220" )
}
label variable myocarditis1 "myocarditis2"
And for myocarditis 2
gen myocarditis2=0
forvalues j=1/25{
replace myocarditis2=1 if inlist(DX`j', "I514", "I408", "I409", "B3320", "A3950", "A3952", "I401", "I400", "A381", "J1082", "I41" )
}
label variable myocarditis2 "myocarditis2"
Thank you.
Laxmi
Related Posts with Expression too long
Summary stats with panel data: obtaining both N (overall obs.) and n (group obs.) by ethnic groupsDear all, I am trying to do some simple mean summary statistics for each variable with panel data (…
reshape / transpose large dataset for mergingI am constructing a large timeseries dataset, with cases arranged around WDI_code (World Development…
Heckprobit regression with dummy variablesI have done a heckprobit regression on a cross section data. My main explanatory variable is a distr…
getting error doing structural testHello all, I am testing for structural breaks using estat sbsingle. I am specifically focusing on th…
Determine how many respondents answered a question where they could select multiple responsesI am no STATA guru, so this may be simple, but I cannot find guidance anywhere (probably because I d…
Subscribe to:
Post Comments (Atom)
0 Response to Expression too long
Post a Comment