Hello,
I am dealing with ICD10 database for nearly 250K observations, what I would like to do in essence is to classified all the diagnoses into the 21 ICD10 chapters. I have created variables ICD10_Chapter1 - ICD10_Chapter21 and each of these variables has a 0 and 1 values. What I wand to do now is to recode all of them ICD_Chapter* but instead to have a 0 and 1 in the new variable, I want to recode them as follow:
ICD10_Chapter1 = 1
ICD10_Chapter2 = 2
ICD10_Chapter3 = 3
ICD10_Chapter4 = 4
ICD10_Chapter5 = 5
ICD10_Chapter21 = 21
to give you an idea of what I did, I used icd10 gen to code each chapter separately, for example, chapter 11 as this: icd10 gen ICD10_Chapters11 = PrincDiag, range(K00/K93)
I included the main diagnosis codes if someone has better and efficient approach.
Thank you
I am dealing with ICD10 database for nearly 250K observations, what I would like to do in essence is to classified all the diagnoses into the 21 ICD10 chapters. I have created variables ICD10_Chapter1 - ICD10_Chapter21 and each of these variables has a 0 and 1 values. What I wand to do now is to recode all of them ICD_Chapter* but instead to have a 0 and 1 in the new variable, I want to recode them as follow:
ICD10_Chapter1 = 1
ICD10_Chapter2 = 2
ICD10_Chapter3 = 3
ICD10_Chapter4 = 4
ICD10_Chapter5 = 5
ICD10_Chapter21 = 21
to give you an idea of what I did, I used icd10 gen to code each chapter separately, for example, chapter 11 as this: icd10 gen ICD10_Chapters11 = PrincDiag, range(K00/K93)
I included the main diagnosis codes if someone has better and efficient approach.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str4 PrincDiag byte(ICD10_Chapters ICD10_Chapters2 ICD10_Chapters3 ICD10_Chapters4 ICD10_Chapters5 ICD10_Chapters6 ICD10_Chapters7 ICD10_Chapters8 ICD10_Chapters9 ICD10_Chapters10) "O342" 0 0 0 0 0 0 0 0 0 0 "R104" 0 0 0 0 0 0 0 0 0 0 "K358" 0 0 0 0 0 0 0 0 0 0 "J931" 0 0 0 0 0 0 0 0 0 1 "O249" 0 0 0 0 0 0 0 0 0 0 "I10" 0 0 0 0 0 0 0 0 1 0 "N202" 0 0 0 0 0 0 0 0 0 0 "I249" 0 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