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
Syntax for lincom won't work in Stata 16 but works fine in Stata 15Hello all. I'm a professor at Baldwin Wallace. On Thursday, I tried to run a lab with my class from …
import data from excel to stata-change the structure of the dataHi, I have a data file in excel which includes more than 300 firms. Information for each firm inclu…
How to tag outliers?Hi, I would like to create a dummy that's equal to 1 if it's an outlier, and 0 if not. I can use -ex…
Proportion experiencing event under competing-risks regressionHi, I am looking at the results of a three-arm clinical trial, where a secondary outcome is the occ…
Separating cumulative data into actualsHi all First of all, apologies if I am not able to explain this very well. I am very new to Stata a…
Subscribe to:
Post Comments (Atom)
0 Response to Expression too long
Post a Comment