Instructions: Step-by-Step Guide to Accessing NHAMCS-ED Public Use Data Files and Programs to Select Injury Records and Calculate Rates


SAS Statements for Identifying Injury Records in NHAMCS-ED

On this Page

The following SAS statements run in a SAS data step and identify which NHAMCS emergency department records were injuries based on the NCHS Injury Team’s definition of injury (See Recommended definition of initial injury visits to emergency departments for use with the NHAMCS-ED data, available on the injury website, for more information.) The injury indicator field is called INJSPB. Records with “INJSPB=1” are injury records. In 2005, the way in which this field was derived changed due to a change in fields on the record. The data prior to 2001 do not include a variable to determine whether the visit was an initial one or not. Definition of an injury record beginning in 2001 includes initial visit status.

SAS Statements for 2005-06

/*CAUSE1 and DIAG1 are variable names used in our SAS input statement.
CAUSE1 is the variable for “Cause of injury #1”
DIAG1 is the variable for “Physician’s diagnosis #1”
INITVIS is an imputed variable to indicate initial visit for problem
INITVIS=1 indicates initial visit*/

CAUSEDET=substr(left(CAUSE1),1,3);
DX13=substr(left(DIAG1),1,3);
DX14=substr(left(DIAG1),1,4);
DX15=substr(left(DIAG1),1,5);

/*defining external cause of injury*/

EXTINJ=0;
IF ‘800’<==CAUSEDET<=’869′ OR ‘880’<=CAUSEDET<=’929′ OR ‘950’<=CAUSEDET<=’999′ THEN EXTINJ=1;
IF (‘870′<=CAUSEDET<=’879’) OR (‘930′<=CAUSEDET<=’949’) THEN EXTINJ=2;

/*defining first listed injury diagnosis*/

NEWINJ=0;
IF (‘8000′<= DX14<=’9092′) OR DX14=’9094’ OR (‘9099′<=DX14<=’9949’) OR (‘99550′<=DX15<=’99559’) OR (‘99580′<=DX15<=’99585’) THEN NEWINJ=1;
IF DX13 < ‘800’ or DX13 >’999′ THEN NEWINJ=2;

/*defining injury records */

INJSPB=0;
IF INITVIS =1 AND ((NEWINJ=1 AND (EXTINJ = 1 OR EXTINJ=0)) OR (NEWINJ=2 AND EXTINJ=1))
THEN INJSPB=1;

SAS Statements for 2001-04, 2007

/*CAUSE1 and DIAG1 are variable names used in our SAS input statement.
CAUSE1 is the variable for “Cause of injury #1”
DIAG1 is the variable for “Physician’s diagnosis #1”
EPISODE is the variable for “Episode of care”
EPISODE=1 indicates initial visit */

CAUSEDET=substr(left(CAUSE1),1,3);
DX13=substr(left(DIAG1),1,3);
DX14=substr(left(DIAG1),1,4);
DX15=substr(left(DIAG1),1,5);

/*defining external cause of injury*/

EXTINJ=0;
IF ‘800’<=CAUSEDET<=’869′ OR ‘880’<=CAUSEDET<=’929′ OR ‘950’<=CAUSEDET<=’999′ THEN EXTINJ=1;
IF (‘870′<=CAUSEDET<=’879’) OR (‘930′<=CAUSEDET<=’949’) THEN EXTINJ=2;

/*defining first listed injury diagnosis*/

NEWINJ=0;
IF (‘8000′<= DX14<=’9092′) OR DX14=’9094’ OR (‘9099′<=DX14<=’9949’) OR
(‘99550′<=DX15<=’99559’)OR (‘99580′<=DX15<=’99585’) THEN NEWINJ=1;
IF DX13 < ‘800’ or DX13 >’999′ THEN NEWINJ=2;

/*defining injury records */

INJSPB=0;
IF EPISODE =1 AND ((NEWINJ=1 AND (EXTINJ = 1 OR EXTINJ=0)) OR (NEWINJ=2 AND EXTINJ=1)) THEN INJSPB=1;

SAS Statements for 1995-2000

/*CAUSE1 and DIAG1 are variable names used in our SAS input statement.
CAUSE1 is the variable for “Cause of injury #1”
DIAG1 is the variable for “Physician’s diagnosis #1”
Variable “Episode” not available prior to 2001*/

CAUSEDET=substr(left(CAUSE1),1,3);
DX13=substr(left(DIAG1),1,3);
DX14=substr(left(DIAG1),1,4);
DX15=substr(left(DIAG1),1,5);

/*defining external cause of injury*/

EXTINJ=0;
IF ‘800’<=CAUSEDET<=’869′ OR ‘880’<=CAUSEDET<=’929′ OR ‘950’<=CAUSEDET<=’999′ THEN EXTINJ=1;
IF (‘870′<=CAUSEDET<=’879’) OR (‘930′<=CAUSEDET<=’949’) THEN EXTINJ=2;

/*defining first listed injury diagnosis*/

NEWINJ=0;
IF (‘8000′<= DX14<=’9092′) OR DX14=’9094’ OR (‘9099′<=DX14<=’9949′) OR DX14=’9955’
OR (‘99580′<=DX15<=’99585’) THEN NEWINJ=1;
IF DX13 < ‘800’ or DX13 >’999′ THEN NEWINJ=2;

/*defining injury records */

NJSPB=0;
IF ((NEWINJ=1 AND (EXTINJ = 1 OR EXTINJ=0)) OR (NEWINJ=2 AND EXTINJ=1)) THEN INJSPB=1;

Page last reviewed: November 6, 2015