hello, I have patient registry data that is coded wide with ICD-10 diagnosis codes. It has one patient id per row. I'd like to create two dummy variables from all of the wide code, TBI_injury and Spinal_injury. The codes for TBI_injury all start with the prefix: S02.0, S02.1, S02.9, S06.0-S06.6, S06.8, S06.9, S06.A, S07.1 . The Spinal_cord injury start with the prefix: S14, S24, or S34. Here is just an example of 3 fake patients (bold values represent code prefixs for TBI or spine) data have; Studynum: ICD10code_1 ICD10code_2 ICD10code_3 1 S02.028A S00.03XA S06.5X9A 2 S14.5X9A S00.83XA S22.028A 3 S06.5X9A S61.412A S34.5X9A data want: Studynum: ICD10code_1 ICD10code_2 ICD10code_3 TBI_injury Spinal_injury 1 S02.028A S00.03XA S06.5X9A 1 0 2 S14.5X9A S00.83XA S22.028A 0 1 3 S06.5X9A S61.412A S34.5X9A 1 1
... View more