/*******************************************************************/ /*DATE: February 6, 2006 */ /*PURPOSE: SAS PROGRAM THAT CREATES COUNTS OF */ /* WEIGHTED TOTAL MENTIONS */ /* BY BODY REGION OF INJURY AND NATURE OF INJURY */ /* FOR MORTALITY DATA USING ICD-10 */ /*PROGRAMMER: ORIGINAL-Margaret Warner MODIFIED-Li-Hui Chen */ /*ICD-10 Codes for the Matrix can be found at: */ /* http://www.cdc.gov/nchs/data/ice/10_diamatrix.pdf */ /*******************************************************************/ /* DATA STEP: Reads ASCII data into SAS data. If you have data in SAS format already, You need to make sure that the variable names agree with the program*/ DATA ALL2002; /*FILENAME needs to be replaced with the file name in your computer FOR EXAMPLE:C:\Injury Team\Mort02us.dat*/ /*INFILE 'FILENAME' LRECL=500;;*/ INFILE 'K:\Injury Team\mortality data\mort02pb\Mort02us.dat' LRECL=500; INPUT RESSTAT 20 DEATH $142-144 /*3 digit ICD-10 underlying cause of death code*/ C4 145 /*4th digit of CDEATH to be used where appropriate*/ CDEATH $142-145 /*4 digit ICD-10 underlying cause of death*/ /*Reads record-axis ICD-10 condition codes*/ RECAXNO $338-339 /*Number of record-axis ICD-10 condition codes*/ RECAX1 $341-345 /*Record-axis ICD-10 condition codes 1 to 20*/ RECAX2 $346-350 RECAX3 $351-355 RECAX4 $356-360 RECAX5 $361-365 RECAX6 $366-370 RECAX7 $371-375 RECAX8 $376-380 RECAX9 $381-385 RECAX10 $386-390 RECAX11 $391-395 RECAX12 $396-400 RECAX13 $401-405 RECAX14 $406-410 RECAX15 $411-415 RECAX16 $416-420 RECAX17 $421-425 RECAX18 $426-430 RECAX19 $431-435 RECAX20 $436-440; IF RESSTAT =4 THEN DELETE; /* DATA STEP 1: For each death, looks through the ICD-10 record-axis codes (RECAX(i)), identifies injury diagnosis codes, counts the number in the death (STNUM) & copies them to a new location (INJURY(i))*/ DATA step1; length stnum 3 injury1-injury20 $4; SET All2002; /*Define underlying cause of injury deaths by intent excluding adverse effects and complications of care */ IF ('V01'<=DEATH<='X59') OR DEATH='Y85' OR DEATH='Y86' THEN INJS=1; *Unintentional; IF ('X60'<=DEATH<='X84') OR CDEATH='Y870' OR DEATH='U03' THEN INJS=2; *Suicide; IF ('X85'<=DEATH<='Y09') OR CDEATH='Y871' OR 'U01'<=DEATH<='U02' THEN INJS=3;*Homicide; IF ('Y10'<=DEATH<='Y34') OR CDEATH='Y872' OR CDEATH='Y899' THEN INJS=4;*Undetermined; IF DEATH='Y35' OR DEATH='Y36' OR (DEATH='Y89' AND 0<=C4<=1) THEN INJS=5;*Legal intervention/war operation; IF INJS>=1 AND INJS<=5 THEN INJALL=1; ELSE INJALL=0; IF INJALL=1; /*RECAX(i) are the original ICD-10 record-axis codes from mortality data file*/ array recax(20) $4 recax1-recax20; /*INJURY(i) is a new variable -- it will have all the valid injury diagnosis codes for the death, the number of diagnosis codes in STNUM*/ array injury(20) $4 injury1-injury20; /*Set the count for total number of injury diagnosis codes in the death to 0*/ STNUM=0; /*Counts number of injury diagnosis codes, and copies them in a new position (Excluding invalid codes for adverse effects and complications of care and their sequelae) */ DO I=1 TO 20; IF recax(I)<='R999' OR recax(I)=>'U00' OR recax(I) IN: ('T983', 'T78') OR ('T80'<=recax(I)<='T889') THEN KEEP=0; ELSE IF ('S00'<=recax(I)<='T999') THEN do; /*Counts number of injury diagnosis codes*/ STNUM+1; /*Copies injury diagnosis codes to a new position; excludes non-injury codes*/ injury(stnum)=recax(i); end; END ; /*Assign STNUM=1 for cases with external cause of death codes but no S or T Codes*/ IF STNUM=0 THEN DO; Injury1='0000'; STNUM=1; END; run; /* DATA STEP 2: For each death, injury diagnosis codes (INJURY(i)) are categorized by body region (BRAC(i)) and nature (NRAC(i)) according to ICD-10 Injury Diagnosis Matrix (IMD)*/ DATA step2; SET step1; ARRAY RECAX(20) $4 RECAX1-RECAX20; *ICD-10 record-axis condition codes; Array injury(20) $4 injury1-injury20; *injury diagnosis codes; array nrac(20) $4 nrac1-nrac20; *IMD nature of injury codes; array brac(20) $4 brac1-brac20; *IMD body region of injury codes; /*SAS Codes for ICD-10 injury mortality diagnosis matrix*/ /*Nature of Injury: The following program recodes ICD-10 injury diagnosis codes to Nature of Injury Codes for count of Total Mentions and Any Mentions*/ DO I=1 TO STNUM; /*Fracture*/ IF Injury(I) IN: ( 'S02', 'S12', 'S22', 'S42', 'S52', 'S62', 'S72', 'S82', 'S92', 'T08', 'T10', 'T12','T142','T902','T911','T912','T921','T922','T931','T932') OR 'S320'<=Injury(I)<='S328' OR 'T021'<=Injury(I)<='T025' OR 'T028'<=Injury(I)<='T029' THEN DO; nrac(i)=1; end; /*Dislocation*/ Else IF Injury(I) IN: ('S530','S531','S730','S830','S831','S930','S931','S933') OR 'S030'<=Injury(I)<='S033' OR 'S130'<=Injury(I)<='S133' OR 'S230'<=Injury(I)<='S232' OR 'S330'<=Injury(I)<='S334' OR 'S430'<=Injury(I)<='S433' OR 'S630'<=Injury(I)<='S632' THEN DO; nrac(i)=2; end; /*Internal Organ Injury*/ Else IF Injury(I) IN: ( 'S06', 'S36', 'S37','S240','S241','S260','S340','S341','S343','S396','S397', 'T065','T093','T905') OR 'S140'<=Injury(I)<='S142' OR 'S270'<=Injury(I)<='S276' OR 'S278'<=Injury(I)<='S279' OR 'T913'<=Injury(I)<='T915' THEN DO; nrac(i)=3; end; /*Open Wound*/ Else IF Injury(I) IN: ( 'S01','S080','S092', 'S11', 'S21', 'S41', 'S51', 'S61', 'S81', 'S91', 'T012','T013','T019','T091','T111','T131','T141','T901','T920','T930') OR 'S052'<=Injury(I)<='S057' OR 'S310'<=Injury(I)<='S315' OR 'S317'<=Injury(I)<='S318' OR 'S710'<=Injury(I)<='S718' THEN DO; nrac(i)=4; end; /*Amputation*/ ELSE IF Injury(I) IN: ( 'S18','S281','S382','S383', 'S48', 'S58', 'S68', 'S78', 'S88', 'S98', 'T050','T052','T053','T055','T058','T059','T096','T116','T136') OR 'S081'<=Injury(I)<='S089' THEN DO; nrac(i)=5; end; /*Blood Vessal*/ Else IF Injury(I) IN: ('S090', 'S15', 'S25', 'S45', 'S55', 'S65', 'S75', 'S85', 'S95', 'T063','T114','T134','T145') OR 'S350'<=Injury(I)<='S355' OR 'S357'<=Injury(I)<='S359' THEN DO; nrac(i)=6; end; /*Superficial & Contusion*/ Else IF Injury(I) IN: ( 'S00','S050','S051', 'S10', 'S20', 'S40', 'S50', 'S60', 'S70', 'S80', 'S90', 'T002','T003','T008','T009','T090','T110','T130','T140','T900') OR 'S300'<=Injury(I)<='S302' OR 'S307'<=Injury(I)<='S309' THEN DO; nrac(i)=7; end; /*Crushing*/ Else IF Injury(I) IN: ('S07','S17','S280','S380','S381','S47','S57','S67','S87','S97') OR 'S770'<=Injury(I)<='S772' OR 'T041'<=Injury(I)<='T043' OR 'T048'<=Injury(I)<='T049' THEN DO; nrac(i)=8; end; /*Burn*/ Else IF Injury(I) IN: ('T28','T30','T31','T32') OR 'T200'<=Injury(I)<='T269' OR 'T270'<=Injury(I)<='T277' OR 'T950'<=Injury(I)<='T954' OR 'T958'<=Injury(I)<='T959' THEN DO; nrac(i)=9; end; /*Effect of Foreign Bodies Entering Orifice*/ Else IF Injury(I) IN: ('T15','T16','T19','T980') OR 'T170'<=Injury(I)<='T175' OR 'T178'<=Injury(I)<='T179' OR 'T180'<=Injury(I)<='T185' OR 'T188'<=Injury(I)<='T189' THEN DO; nrac(i)=10; end; /*Other Effect of External Causes*/ Else IF Injury(I) IN: ('T33','T34') OR 'T350'<=Injury(I)<='T357' OR 'T660'<=Injury(I)<='T759' THEN DO; nrac(i)=11; end; /*Poisoning*/ Else IF Injury(I) IN: ('T96') OR 'T360'<=Injury(I)<='T509' THEN DO; nrac(i)=12; end; /*Toxic Effect*/ Else IF Injury(I) IN: ('T97') OR 'T510'<=Injury(I)<='T659' THEN DO; nrac(i)=13; end; /*Multiple Injuries*/ Else IF Injury(I) IN: ('S097','S197','S277','S297','S497','S597','S697','S797','S897','S997', 'T092','T112','T132','T143','T147','T910','T923','T926','T933','T936') OR 'T031'<=Injury(I)<='T033' OR 'T038'<=Injury(I)<='T039' THEN DO; nrac(i)=14; end; /*Other Specified Injury*/ Else IF Injury(I) IN: ( 'S04','S034','S035','S058','S091','S098', 'S16','S198','S268','S290','S298','S342', 'S348','S390','S398', 'S44', 'S46','S498', 'S54', 'S56','S598', 'S64', 'S66', 'S698','S731', 'S74','S798', 'S84', 'S86','S898','S932', 'S94', 'S96','S998', 'T062','T064','T094','T095','T098','T113','T115','T118','T133','T135','T138','T144','T146', 'T79','T903','T904','T908','T918','T924','T925','T928','T934','T935','T938','T982') OR 'S134'<=Injury(I)<='S136' OR 'S143'<=Injury(I)<='S146' OR 'S233'<=Injury(I)<='S235' OR 'S242'<=Injury(I)<='S246' OR 'S335'<=Injury(I)<='S337' OR 'S344'<=Injury(I)<='S346' OR 'S434'<=Injury(I)<='S437' OR 'S532'<=Injury(I)<='S534' OR 'S633'<=Injury(I)<='S637' OR 'S760'<=Injury(I)<='S767' OR 'S832'<=Injury(I)<='S836' OR 'S934'<=Injury(I)<='S936' THEN DO; nrac(i)=15; end; /*Unspecified Injury*/ Else IF Injury(I) IN: ('S059','S099','S199','S269','S299','S399','S499','S599','S699','S799','S837','S899','S999', 'T07','T099','T119','T139','T148','T149','T909','T919','T929','T939','T940','T941','T981') THEN DO; nrac(i)=16; end; end; /*Body Region of Injury: The following program recodes ICD-10 injury diagnosis codes to Body Region of Injury Codes for count of Total Mentions and Any Mentions;*/ do i=1 to stnum; /*Traumatic Brain Injury(TBI)*/ IF Injury(I) IN: ( 'S01','S020','S021','S023','S040', 'S06', 'S07', 'T901','T902','T904','T905','T908','T909') OR 'S027'<=Injury(I)<='S029' OR 'S097'<=Injury(I)<='S099' THEN DO; brac(i)=1; end; /*Other Head*/ Else IF Injury(I) IN: ( 'S00', 'S05', 'S08','S022', 'T15', 'T16','T170','T171','T180', 'T26','T330','T340', 'T900', 'T903') OR 'S024'<=Injury(I)<='S026' OR 'S030'<=Injury(I)<='S035' OR 'S041'<=Injury(I)<='S049' OR 'S090'<=Injury(I)<='S092' THEN DO; brac(i)=2; end; /*Neck*/ Else IF Injury(I) IN: ( 'S10', 'S11','S128','S129','S132','S133','S135','S136', 'S150', 'S16', 'S17', 'S18', 'T270','T274','T331','T341') OR 'S143'<=Injury(I)<='S146' OR 'S152'<=Injury(I)<='S159' OR 'S197'<=Injury(I)<='S199' OR 'T172'<=Injury(I)<='T174' THEN DO; brac(i)=3; end; /*Other Head & Neck*/ Else IF Injury(I) IN: ('T20','T280','T285','T352','T950') THEN DO; brac(i)=4; end; /*Spinal Cord*/ Else IF Injury(I) IN: ('S140','S141','S240','S241','S340','S341','S343','T093','T913') THEN DO; brac(i)=5; end; /*Vertebral Column*/ Else IF Injury(I) IN: ('S130','S131','S134','S142','S151','S220','S221', 'S230','S231','S233','S242','S342','S344', 'T08','T911','T094' ) OR 'S120'<=Injury(I)<='S127' OR 'S320'<=Injury(I)<='S322' OR 'S330'<=Injury(I)<='S332' OR 'S335'<=Injury(I)<='S337' THEN DO; brac(i)=6; end; /*Thorax*/ Else IF Injury(I) IN: ( 'S20', 'S21','S232','S234','S235', 'S25','S260','S268','S269','S27','S280','S281','S290', 'T175','T281','T286','T332','T342','T914') OR 'S222'<=Injury(I)<='S229' OR 'S243'<=Injury(I)<='S246' OR 'S297'<=Injury(I)<='S299' THEN DO; brac(i)=7; end; /*Abdomen*/ Else IF Injury(I) IN: ('S301','S311','S318','S36') OR 'S350'<=Injury(I)<='S354' OR 'T182'<=Injury(I)<='T184' THEN DO; brac(i)=8; end; /*Pelvis & Lower Back*/ Else IF Injury(I) IN: ('S300','S302','S310','S333','S334','S345','S355', 'S37','S380','S382', 'T185', 'T19','T283','T288') OR 'S312'<=Injury(I)<='S315' OR 'S323'<=Injury(I)<='S328' THEN DO; brac(i)=9; end; /*Abdomen, Lower Back & Pelvis*/ Else IF Injury(I) IN: ('S317','S346','S348','S381','S383','S390', 'T021','T031','T047','T065','T333','T343','T353','T915') OR 'S307'<=Injury(I)<='S309' OR 'S357'<=Injury(I)<='S359' OR 'S396'<=Injury(I)<='S399' THEN DO; brac(i)=10; end; /*Other Trunk*/ Else IF Injury(I) IN: ('T041','T095','T096','T098','T099','T178','T179','T181','T188','T189', 'T21','T272','T273','T276','T277','T282','T287','T912','T951') OR 'T090'<=Injury(I)<='T092' THEN DO; brac(i)=11; end; /*Upper Extremity*/ Else IF Injury(I) IN: ('T002','T012','T022','T024','T032','T042','T050','T052', 'T10','T118','T119', 'T22', 'T23','T334','T335','T344','T345','T354','T928','T929','T952') OR 'S400'<=Injury(I)<='S429' OR 'S430'<=Injury(I)<='S437' OR 'S440'<=Injury(I)<='S489' OR 'S497'<=Injury(I)<='S499' OR 'S500'<=Injury(I)<='S529' OR 'S530'<=Injury(I)<='S534' OR 'S540'<=Injury(I)<='S589' OR 'S597'<=Injury(I)<='S599' OR 'S600'<=Injury(I)<='S629' OR 'S630'<=Injury(I)<='S637' OR 'S640'<=Injury(I)<='S689' OR 'S697'<=Injury(I)<='S699' OR 'T110'<=Injury(I)<='T116' OR 'T920'<=Injury(I)<='T926' THEN DO; brac(i)=12; end; /*Hip*/ Else IF Injury(I) IN: ('S700','S710','S730','S731','S760','S770','S780') OR 'S720'<=Injury(I)<='S722' THEN DO; brac(i)=13; end; /*Other Lower Extremity*/ Else IF Injury(I) IN: ('S74','S75','S771','S772', 'T003','T013','T023','T025','T033','T043','T053','T055', 'T12', 'T24','T25', 'T355','T953') OR 'S701'<=Injury(I)<='S709' OR 'S711'<=Injury(I)<='S718' OR 'S723'<=Injury(I)<='S729' OR 'S761'<=Injury(I)<='S767' OR 'S781'<=Injury(I)<='S789' OR 'S797'<=Injury(I)<='S799' OR 'S800'<=Injury(I)<='S829' OR 'S830'<=Injury(I)<='S837' OR 'S840'<=Injury(I)<='S889' OR 'S897'<=Injury(I)<='S899' OR 'S900'<=Injury(I)<='S929' OR 'S930'<=Injury(I)<='S936' OR 'S940'<=Injury(I)<='S989' OR 'S997'<=Injury(I)<='S999' OR 'T130'<=Injury(I)<='T136' OR 'T138'<=Injury(I)<='T139' OR 'T336'<=Injury(I)<='T338' OR 'T346'<=Injury(I)<='T348' OR 'T930'<=Injury(I)<='T936' OR 'T938'<=Injury(I)<='T939' THEN DO; brac(i)=14; end; /*Multiple Body Regions*/ Else IF Injury(I) IN: ('T008','T009','T019','T028','T029','T038','T039','T048','T049','T058','T059', 'T07','T271','T275','T289','T350','T351','T356','T910','T919','T918','T940') OR 'T062'<=Injury(I)<='T064' THEN DO; brac(i)=15; end; /*System Wide*/ Else IF Injury(I) IN: ( 'T79', 'T96', 'T97','T982') OR 'T360'<=Injury(I)<='T759' THEN DO; brac(i)=16; end; /*Unspecitied*/ Else IF Injury(I) IN: ( 'T14','T284','T339','T349','T357','T941','T954','T958','T959','T980','T981') OR 'T300'<=Injury(I)<='T329' THEN DO; brac(i)=17; end; END; run; PROC FORMAT; VALUE BL1FM 1='HEAD & NECK' 2='SPINE & BACK' 3='TORSO' 4='EXTREMITIES' 5='NOT CLASSIFIABLE BY SITE' 6='UNSPECIFIED'; VALUE BL2FM 1='TBI' 2='OTHER HEAD' 3='NECK' 4='HEAD & NECK' 5='SPINAL CORD' 6='VERTERBRAL COLUMN' 7='THORAX' 8='ABDOMEN' 9='PELVIS & LOWER BACK' 10='ABD, LB, & PELVIS' 11='TRUNK, OTHER' 12='UPPER EXTREMITY' 13='HIP' 14='OTHER LOWER EXTREMITY' 15='MULTIPLE BODY REGIONS' 16='SYSTEM WIDE' 17='UNSPECIFIED REGION'; VALUE NL1FM 1='FRACTURE' 2='DISLOCATION' 3='INTERNAL ORGAN' 4='OPEN WOUND' 5='AMPUTATION' 6='BLOOD VESSEL' 7='SUPERFICIAL/CONTUSION' 8='CRUSH' 9='BURN' 10='EFFECT OF FOREIGN BODY' 11='OTHER EFFECTS OF EXTERNAL CAUSES' 12='POISONING' 13='TOXIC EFFECTS' 14='MULTIPLE INJURIES' 15='OTHER SPECIFIED INJURIES' 16='UNSPECIFIED NATURE'; /* THIS DATA STEP: Changes data layout from one record per death to one record per injury diagnosis code. This makes it possible to easily count the weighted total mentions of diagnosis using a simple frequency. Note that the number of records in data will be the number of injury diagnosis codes not the number of injury deaths. Fields on the record are now: Injury diagnosis code (OINJURY), Weight for weighted total mentions (WTM and WTM=1/STNUM), Number of injury diagnosis codes in the death (STNUM), and Level 1 body region (TL1b), Level 2 body region (TL2b), and Level 1 nature (TL1n)*/ Data oneper; set step2; array injury(20) $4 injury1-injury20; array nrac(20) 4 nrac1-nrac20; array brac(20) 4 brac1-brac20; do i=1 to stnum; Oinjury=injury(i); wtm=1/stnum; *creates the weight for weighted total mentions; if brac(i) in (1,2,3,4) then TL1b=1; *recodes from brac1-brac17 to TL1b; if brac(i) in (5,6) then TL1b=2; if brac(i) in (7,8,9,10,11) then TL1b=3; if brac(i) in (12,13,14) then TL1b=4; if brac(i) in (15,16) then TL1b=5; if brac(i) in (17) then TL1b=6; if brac(i) in (1) then TL2b=1; *recodes from brac1-brac17 to TL2b; if brac(i) in (2) then TL2b=2; if brac(i) in (3) then TL2b=3; if brac(i) in (4) then TL2b=4; if brac(i) in (5) then TL2b=5; if brac(i) in (6) then TL2b=6; if brac(i) in (7) then TL2b=7; if brac(i) in (8) then TL2b=8; if brac(i) in (9) then TL2b=9; if brac(i) in (10) then TL2b=10; if brac(i) in (11) then TL2b=11; if brac(i) in (12) then TL2b=12; if brac(i) in (13) then TL2b=13; if brac(i) in (14) then TL2b=14; if brac(i) in (15) then TL2b=15; if brac(i) in (16) then TL2b=16; if brac(i) in (17) then TL2b=17; if nrac(i) in (1) then TL1n=1; *recodes from nrac1-brac16 to TL1n; if nrac(i) in (2) then TL1n=2; if nrac(i) in (3) then TL1n=3; if nrac(i) in (4) then TL1n=4; if nrac(i) in (5) then TL1n=5; if nrac(i) in (6) then TL1n=6; if nrac(i) in (7) then TL1n=7; if nrac(i) in (8) then TL1n=8; if nrac(i) in (9) then TL1n=9; if nrac(i) in (10) then TL1n=10; if nrac(i) in (11) then TL1n=11; if nrac(i) in (12) then TL1n=12; if nrac(i) in (13) then TL1n=13; if nrac(i) in (14) then TL1n=14; if nrac(i) in (15) then TL1n=15; if nrac(i) in (16) then TL1n=16; keep Oinjury wtm stnum TL1b TL2b TL1n; format TL1b BL1FM. TL2b BL2FM. TL1n NL1FM.; if Oinjury ne '0000' then output; end; run; /*create counts for Weighted Total Mentions*/ Proc freq data=oneper; tables TL1b TL2b TL1n/LIST; weight wtm; Title 'Weighted Total Mentions';run; /*create counts for matrix of Weighted Total Mentions*/ Proc freq data=oneper; tables TL1b*TL1n TL2b*TL1n/LIST; weight wtm; Title 'Weighted Total Mentions';run;