Hi:

I have a dataset that looks like this:

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str6 DUID double PID str8 DUPERSID str4 ICD10CDX
"10001" 101 "10001101" "J00"
"10001" 101 "10001101" "M76"
"10001" 101 "10001101" "H52"
"10001" 101 "10001101" "J32"
"10001" 101 "10001101" "-9" 
"10001" 102 "10001102" "J00"
"10001" 102 "10001102" "M54"
end
DUID is dwelling unit; PID is person ID within each dwelling unit; DUPERSID is unique person identifier created by merging the first two ids. The unit of observation is a medical condition denoted by ICD10CDX. So the the first 5 observations are for one individual for 5 different conditions.

I want to create a new variable say X from the variable ICD10CDX such that if if ICD10CDX=="J00"|ICD10CDX=="J32" for a given individual, then X=1. I will eventually reshape the data from long to wide format so that there is one observation per person and I want the X value for that person ( so if he had either condition J00 or J32, his X value is 1). I know I could reshape the dataset first and then create X but there are upto 70 different conditions and it will take a lot of typing.