Good evening,
I was wondering if someone could help me out here.
I'm working with the national inpatient sample database which uses ICD 10 codes for diseases.
I have the following variables: I10_DX1 through I10_DX40
Each of these variables have ICD codes for example stroke: Every ICD code for stroke starts with "I63"
I would like to create a new variable called "STROKE" using syntax to loop through 10_DX1 through I10_DX40 looking for "I63" and give a value of 1 if present and 0 if not present. I have been able to do this on STATA however STATA is too slow. I pasted the code I used in STATA as an example.
generate STROKE=0
foreach var of varlist I10_DX2-I10_DX40 {
replace STROKE=1 if substr(`var',1,4)=="I63"
}
Thanks
Christian
------------------------------
Christian Torres
------------------------------
#SPSSStatistics