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 Visit Rates

 

SAS and SUDAAN Programs for Variance Estimation

Sample SAS and SUDAAN codes and documentation for variance estimation of complete NHAMCS-ED data.

Sample Codes for 2002-05

PROC SORT DATA=xxx; /* replace xxx with the name that you want to use for your SAS dataset */
BY CSTRATM CPSUM;
 
PROC CROSSTAB DATA=xxx DESIGN=WR FILETYPE=SAS;
NEST CSTRATM CPSUM/MISSUNIT;
WEIGHT PATWT;
CLASS SEX; /* replace SEX with the variable that you would like to use */
TABLES SEX; /* replace SEX with the variable that you would like to use */
PRINT /STYLE=NCHS;
RUN;

 

Sample Codes for 1993-2001

Step 1

Since the two variables, “CSTRATM” & “CPSUM”, for variance estimation is not included in data files before 2002. The following program is needed to calculate them from existing variables from the public use data file. This code needs to be included in a SAS data step.

CSTRATM=STRATM;
CPSUM=PSUM;
IF CPSUM IN (1 2 3 4) THEN DO;
CSTRATM=(STRATM*100000)+(1000*(MOD(YEAR,100)))+
(SUBFILE*100)+PROSTRAT;
CPSUM=PROVIDER+100000;
END;
ELSE CSTRATM=(STRATM*100000);

Step 2

Sample SAS and SUDAAN codes for variance estimation

PROC SORT DATA=xxx; /* replace xxx with the name that you want to use for your SAS dataset */
BY CSTRATM CPSUM;
 
PROC CROSSTAB DATA=xxx DESIGN=WR FILETYPE=SAS;
NEST CSTRATM CPSUM/MISSUNIT;
WEIGHT PATWT;
CLASS SEX; /* replace SEX with the variable that you would like to use */
TABLES SEX; /* replace SEX with the variable that you would like to use */
PRINT /STYLE=NCHS;
RUN;

 

 

Page Last Modified: October 15, 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