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