SAS Input Statements

ICD-10 Matrix, November 2002, Terrorism Codes (*U01-*U03) added 8/26/03

/*
SAS code to produce external cause code matrix using ICD-10 codes
INPUT VARIABLES:
DEATH 3 character alpha/numeric ICD-10 code [as in V01]
CDEATH 4 character alpha/numeric ICD-10 code [as in V892]
C4 4th character of 4-character ICD-10 code
OUTPUT VARIABLES:
CAUSE cause of death
INJS intent
MVTPER detail of motor vehicle
ADV adverse effects
*/
data matrix;
set yourdata;

IF (‘W25′<=DEATH<=’W29′ OR DEATH=’W45’) OR
(DEATH=’X78′) OR
(DEATH=’X99′) OR
(CDEATH=’Y354′) OR
(DEATH=’Y28′) THEN CAUSE=00;

IF (‘W65′<=DEATH<=’W74’) OR
(DEATH=’X71′) OR
(DEATH=’X92′) OR
(DEATH=’Y21′) THEN CAUSE=01;

IF (‘W00′<=DEATH<=’W19’) OR
(DEATH=’X80′) OR
(DEATH=’Y01′) OR
(DEATH=’Y30′) THEN CAUSE=02;

IF (‘X00′<=DEATH<=’X09’) OR
(DEATH=’X76′) OR
(DEATH=’X97′) OR
(CDEATH=’Y363′) OR
(DEATH=’Y26′) OR (CDEATH=’U013′) THEN CAUSE=03;

IF (‘X10′<=DEATH<=’X19’) OR
(DEATH=’X77′) OR
(DEATH=’X98′ ) OR
(DEATH=’Y27′) THEN CAUSE=04;

IF (‘W32′<=DEATH<=’W34’) OR
(‘X72′<=DEATH<=’X74’) OR
(‘X93′<=DEATH<=’X95’) OR
(CDEATH=’Y350′) OR
(‘Y22′<=DEATH<=’Y24′) OR (CDEATH=’U014’) THEN CAUSE=05;

IF (DEATH=’W24′ OR ‘W30′<=DEATH<=’W31’) THEN CAUSE=06;

IF ((‘V30′<=DEATH<=’V79’ AND 4<=C4<=9) OR
(‘V81′<=DEATH<=’V82’ AND C4=1) OR (‘V83′<=DEATH<=’V86’
AND 0<=C4<=3)) OR
((‘V20′<=DEATH<=’V28’ AND 3<=C4<=9) OR
(DEATH=’V29′ AND (4<=C4<=9))) OR
((‘V12′<=DEATH<=’V14’ AND 3<=C4<=9) OR
(DEATH=’V19′ AND (4<=C4<=6 ))) OR
((‘V02′<=DEATH<=’V04’ AND C4 IN (1,9)) OR
CDEATH=’V092′) OR
(DEATH=’V80′ AND 3<=C4<=5) OR
((DEATH=’V87′ AND 0<=C4<=8) OR CDEATH=’V892′) THEN CAUSE=07;

IF (DEATH IN (‘V10′,’V11′,’V15′,’V16′,’V17′,’V18’) OR
(‘V12′<=DEATH<=’V14’ AND 0<=C4<=2) OR
(DEATH=’V19′ AND 0<=C4<=3) OR CDEATH=’V198′
OR CDEATH=’V199′ ) THEN CAUSE=08;

IF ((DEATH IN (‘V01′,’V05′,’V06’)) OR
(‘V02′<=DEATH<=’V04′ AND C4=0) OR (DEATH=’V09’
AND C4 IN (0,1,3,9)) ) THEN CAUSE=09;

IF (‘V20′<=DEATH<=’V28’ AND 0<=C4<=2) OR
(DEATH=’V29′ AND 0<=C4<=3) OR
(‘V30′<=DEATH<=’V79’ AND 0<=C4<=3) OR
(DEATH IN (‘V80’) AND C4 IN (0,1,2,6,7,8,9)) OR
(DEATH IN (‘V81′,’V82’) AND C4 IN (0,2,3,4,5,6,7,8,9)) OR
(‘V83′<=DEATH<=’V86’ AND 4<=C4<=9) OR
(CDEATH IN (‘V879’)) OR
(DEATH IN (‘V88’) AND 0<=C4<=9) OR
(DEATH IN (‘V89’) AND C4 IN (0,1,3,9)) OR
(DEATH=’X82′ OR DEATH=’Y03′ OR DEATH=’Y32′) THEN CAUSE=10;

IF (‘V90′ <=DEATH<=’V99’) OR
(CDEATH=’Y361′) OR (CDEATH=’U011′) THEN CAUSE=11;

IF (‘W92′<=DEATH<=’W99’ OR
‘X20′<=DEATH<=’X39’ OR
‘X51′<=DEATH<=’X57’ OR
‘W42′<=DEATH<=’W43’ OR
‘W53′<=DEATH<=’W64’) THEN CAUSE=12;

IF (DEATH=’X50′) THEN CAUSE=13;

IF (‘X40′<=DEATH<=’X49’) OR
(‘X60′<=DEATH<=’X69’) OR
(‘X85′<=DEATH<=’X90’) OR
(‘Y10′<=DEATH<=’Y19’) OR
(CDEATH=’Y352′) OR (‘U016′<=CDEATH<=’U017’) THEN CAUSE=14;

IF (‘W20′<=DEATH<=’W22’ OR
‘W50′<=DEATH<=’W52’) OR
(DEATH=’X79′) OR
(DEATH=’Y00′ OR DEATH=’Y04′) OR
(CDEATH=’Y353′) OR
(DEATH=’Y29′) THEN CAUSE=15;

IF (‘W75′<=DEATH<=’W84’) OR
(DEATH=’X91′) OR
(DEATH=’X70′) OR
(DEATH=’Y20′) THEN CAUSE=16;

IF (DEATH=’W23′ OR
‘W35′<=DEATH<=’W41’ OR
DEATH IN (‘W44′,’W49′,’Y85’) OR
‘W85′<=DEATH<=’W91’) OR
(DEATH IN (‘X75′,’X81’)) OR
(DEATH IN (‘X96′,’Y02’) OR
‘Y05′<=DEATH<=’Y07’) OR
(CDEATH IN (‘Y351′,’Y355’, ‘Y360’,
‘Y362’) OR ‘Y364′<=CDEATH<=’Y368’) OR
(DEATH IN (‘Y25′,’Y31’)) OR (CDEATH IN(‘U010’, ‘U012’, ‘U015’, ‘U030’)) THEN CAUSE=17;

IF (DEATH=’X58′ OR DEATH=’Y86′) OR
(DEATH=’X83′ OR CDEATH=’Y870′) OR
(DEATH=’Y08′ OR CDEATH=’Y871′) OR
(CDEATH IN (‘Y356′,’Y890′,’Y891’)) OR
(DEATH=’Y33′ OR CDEATH=’Y872′) OR CDEATH=’U018′ OR DEATH=’U02′ THEN CAUSE=18;

IF (DEATH=’X59′) OR
(DEATH=’X84′) OR
(DEATH=’Y09′) OR
(CDEATH IN (‘Y357′,’Y369’)) OR
(DEATH=’Y34′ OR CDEATH=’Y899′) OR CDEATH=’U019′ OR CDEATH=’U039′ THEN CAUSE=19;

IF ((‘V30′<=DEATH<=’V79’ AND 4<=C4<=9) OR
(‘V83′<=DEATH<=’V86’
AND 0<=C4<=3)) THEN MVTPER=1;
IF ((‘V20′<=DEATH<=’V28’ AND 3<=C4<=9) OR
(DEATH=’V29′ AND (4<=C4<=9))) THEN MVTPER=2;
IF ((‘V12′<=DEATH<=’V14’ AND 3<=C4<=9) OR
(DEATH=’V19′ AND (4<=C4<=6 ))) THEN MVTPER=3;
IF ((‘V02′<=DEATH<=’V04’ AND C4 IN (1,9)) OR
CDEATH=’V092′ ) THEN MVTPER=4;
IF (DEATH=’V80′ AND 3<=C4<=5) OR
(‘V81′<=DEATH<=’V82’ AND C4=1) THEN MVTPER=5;
IF ((DEATH=’V87′ AND 0<=C4<=8) OR CDEATH=’V892′) THEN MVTPER=6;

IF (‘V01′<=DEATH<=’X59′) OR DEATH=’Y85′ OR DEATH=’Y86’ THEN INJS=1;
IF (‘X60′<=DEATH<=’X84′) OR CDEATH=’Y870′ OR DEATH=’U03’ THEN INJS=2;
IF (‘X85′<=DEATH<=’Y09′) OR CDEATH=’Y871’ OR ‘U01′<=DEATH<=’U02’ THEN INJS=3;
IF (‘Y10′<=DEATH<=’Y34′) OR CDEATH=’Y872′ OR CDEATH=’Y899’ THEN INJS=4;

IF DEATH=’Y35′ OR DEATH=’Y36′ OR (DEATH=’Y89′ AND 0<=C4<=1) THEN INJS=5;

IF (‘Y40′<=DEATH<=’Y84′) OR DEATH=’Y88’ THEN ADV=1;

PROC FORMAT;
VALUE INJSM
1=’UNINTENTIONAL’
2=’SUICIDE’
3=’HOMICIDE’
4=’UNDETERMINED’
5=’LEGAL/WAR’;
VALUE MVPM
1=’ OCCUPANT’
2=’ MC’
3=’ PEDAL CYC’
4=’ PEDEST’
5=’ OTHER’
6=’ UNSPECIFIED’ ;

VALUE CAUSEM
0=’CUT/PIERCE’
1=’DROWNING’
2=’FALL’
3=’FIRE/FLAME’
4=’HOT OBJECT/SCALD’
5=’FIREARM’
6=’MACHINERY’
7=’MV TRAFFIC’
8=’OTHER PEDAL CYC’
9=’OTHER PEDESTRIAN’
10=’OTHER LAND TRANSPORT’
11=’OTHER TRANSPORT’
12=’NATURAL/ENVIR’
13=’OVEREXERTION’
14=’POISONING’
15=’STRUCK BY/AGAINST’
16=’SUFFOCATION’
17=’OTHER SPEC’
18=’NEC’
19=’NOT SPECIFIED’;

PROC FREQ;
TABLES MVTPER CAUSE INJS ADV /LIST MISSING;
FORMAT MVTPER MVPM. CAUSE CAUSEM. INJS INJSM.;

run;