CDC en Español

National Center for Health Statistics  Monitoring the Nation's Health

Injury Data and Resources

  • Email this page

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

 

STATA Programs for Identifying Injury Records

The following "Do" files  run STATA statements that will identify which NHAMCS emergency department records were for 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. In 2005, the way in which this field was derived changed due to a change in fields on the record. The first do-file is for using data from 2005 and the second do-file is for data from 2002-2004.

*DO-FILE FOR USING DATA FROM 2005

 

*Replace c:\nhamcs\ed with the directory containing your dataset
Cd “c:\nhamcs\ed”
*Replace ed with the name of your dataset
use "ed.dta", clear
*Create variables to use in deriving the injury indicator
gen causedet=strofreal(cause13d)
gen diag14d=substr(diag1,1,4)
gen diag15d=diag1

 

*Determine if record has an external cause of injury
gen EXTINJ=0

 

replace EXTINJ=1 if (causedet >= "800" & causedet <= "869")
replace EXTINJ=1 if (causedet >= "880" & causedet <= "929")
replace EXTINJ=1 if (causedet >= "950" & causedet <= "999")
replace EXTINJ=2 if (causedet >= "870" & causedet <= "879")
replace EXTINJ=2 if (causedet >= "930" & causedet <= "949")

 

*Determine if the first listed diagnosis on the record is for injury
gen NEWINJ=0

 

replace NEWINJ=1 if (diag14d >= "8000" & diag14d <= "9092")
replace NEWINJ=1 if (diag14d == "9094" )
replace NEWINJ=1 if (diag14d >= "9099" & diag14d <= "9949")
replace NEWINJ=1 if (diag15d >= "99550" & diag15d <= "99559")
replace NEWINJ=1 if (diag15d >= "99580" & diag15d <= "99585")
replace NEWINJ=2 if (diag13d < "800" | diag13d > "999")

 

*Determine if the record should be considered an injury record
gen INJSPB=0

 

replace INJSPB=1 if (initvis==1 & (NEWINJ==1 & EXTINJ==1))
replace INJSPB=1 if (initvis ==1 & (NEWINJ==1 & EXTINJ==0))
replace INJSPB=1 if (initvis ==1 & (NEWINJ==2 & EXTINJ==1))

 

*Run frequency of injuries weighting data with patwt
tab INJSPB [weight=patwt]

 

*DO-FILE FOR USING DATA FROM 2002-2004

 

*Replace c:\nhamcs\ed with the directory containing your dataset
Cd “c:\nhamcs\ed”
*Replace ed with the name of your dataset
use "ed.dta", clear
*Create variables to use in deriving the injury indicator
gen causedet=strofreal(cause13d)
gen diag14d=substr(diag1,1,4)
gen diag15d=diag1

 

*Determine if record has an external cause of injury
gen EXTINJ=0

 

replace EXTINJ=1 if (causedet >= "800" & causedet <= "869")
replace EXTINJ=1 if (causedet >= "880" & causedet <= "929")
replace EXTINJ=1 if (causedet >= "950" & causedet <= "999")
replace EXTINJ=2 if (causedet >= "870" & causedet <= "879")
replace EXTINJ=2 if (causedet >= "930" & causedet <= "949")

 

*Determine if the first listed diagnosis on the record is for injury
gen NEWINJ=0

 

replace NEWINJ=1 if (diag14d >= "8000" & diag14d <= "9092")
replace NEWINJ=1 if (diag14d == "9094" )
replace NEWINJ=1 if (diag14d >= "9099" & diag14d <= "9949")
replace NEWINJ=1 if (diag15d >= "99550" & diag15d <= "99559")
replace NEWINJ=1 if (diag15d >= "99580" & diag15d <= "99585")
replace NEWINJ=2 if (diag13d < "800" | diag13d > "999")

 

*Determine if the record should be considered an injury record
gen INJSPB=0

 

replace INJSPB=1 if (episode==1 & (NEWINJ==1 & EXTINJ==1))
replace INJSPB=1 if (episode==1 & (NEWINJ==1 & EXTINJ==0))
replace INJSPB=1 if (episode==1 & (NEWINJ==2 & EXTINJ==1))

 

*Run frequency of injuries weighting data with patwt
tab INJSPB [weight=patwt]

Page Last Modified: September 26, 2008

Our Links

What's New

Quick Links

Related Links

Contact Injury

Special Projects Branch
Office of Analysis and Epidemiology
NCHS, Centers for Disease Control and Prevention
Mailstop P08
nchsinjury@cdc.gov

National Center for Health Statistics
3311 Toledo Road
Hyattsville, MD 20782
Phone: 1-800-232-4636
nchsquery@cdc.gov

Safer Healthier People

Centers for Disease Control and Prevention, 1600 Clifton Rd, Atlanta, GA 30333, U.S.A
Tel: (404) 639-3311 / Public Inquiries: (404) 639-3534 / (800) 311-3435