Skip directly to local search Skip directly to A to Z list Skip directly to navigation Skip directly to site content Skip directly to page options
CDC Home

Injury Data and Resources

Instructions:  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-2005

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;

 

 

 

 

Injury Data
Contact Us:
  • Office of Analysis and Epidemiology
    National Center for Health Statistics
    3311 Toledo Rd
    Hyattsville, MD 20782
  • 1 (800) 232-4636
  • nchsinjury@cdc.gov
USA.gov: The U.S. Government's Official Web PortalDepartment of Health and Human Services
Centers for Disease Control and Prevention   1600 Clifton Rd. Atlanta, GA 30333, USA
800-CDC-INFO (800-232-4636) TTY: (888) 232-6348 - Contact CDC–INFO
A-Z Index
  1. A
  2. B
  3. C
  4. D
  5. E
  6. F
  7. G
  8. H
  9. I
  10. J
  11. K
  12. L
  13. M
  14. N
  15. O
  16. P
  17. Q
  18. R
  19. S
  20. T
  21. U
  22. V
  23. W
  24. X
  25. Y
  26. Z
  27. #