I have a dataset that contains several ICD-10 codes along with their explanations. I would like to generate new variables based on the ICD-10 codes in the dataset. New variables will be like ICD_var1,ICD_var2,... on the table. I would like to improve my abilities for this kind of variables. I could not find similar examples. Could you please help me? Thank you in advance.(The screenshot is what I want to have)
/***My data creating code***/
data patient_icd;
input Patient_ID ICD_CODES $100.;
ICD_VAR1 = scan(ICD_CODES, 1, '|');
ICD_VAR2 = scan(ICD_CODES, 2, '|');
ICD_VAR3 = scan(ICD_CODES, 3, '|');
ICD_VAR4 = scan(ICD_CODES, 4, '|');
ICD_VAR5 = scan(ICD_CODES, 5, '|');
ICD_VAR6 = scan(ICD_CODES, 6, '|');
ICD_VAR7 = scan(ICD_CODES, 7, '|');
ICD_VAR8 = scan(ICD_CODES, 8, '|');
ICD_VAR9 = scan(ICD_CODES, 9, '|');
ICD_VAR10 = scan(ICD_CODES, 10, '|');
ICD_VAR11 = scan(ICD_CODES, 11, '|');
ICD_VAR12 = scan(ICD_CODES, 12, '|');
ICD_VAR13 = scan(ICD_CODES, 13, '|');
datalines;
234423 (#1) Sickle-cell disease without crisis (D57.1) [POA=] | (#2) Idiopathic aseptic necrosis of unspecified bone (M87.00) [POA=] | (#3) Anxiety disorder, unspecified (F41.9) [POA=] | (#4) Osteonecrosis, unspecified (M87.9) [POA=] | (#5) Other symptoms and signs involving emotional state (R45.89) [POA=] | (#6) Other specified health status (Z78.9) [POA=] | (#7) Other specified counseling (Z71.89) [POA=] | (#8) Other long term (current) drug therapy (Z79.899) [POA=] | (#9) Encounter for therapeutic drug level monitoring (Z51.81) [POA=] | (#10) Counseling, unspecified (Z71.9) [POA=]
8723492 (#1) Sickle-cell disease without crisis (D57.1) [POA=] | (#2) Idiopathic aseptic necrosis of unspecified bone (M87.00) [POA=] | (#3) Osteonecrosis, unspecified (M87.9) [POA=] |
... View more