Data Resource Center - Code library

National Health and Nutrition Examination Survey (NHANES)

NHANES 1988-1994 (NHANES III)

The code library currently contains programs for the oral health sections from NHANES 1988-1994.

SAS/SAS-callable SUDAAN programs

Programs to create estimates published in the MMWR Surveillance Summary
Programs to convert data files provided on NCHS Web site to SAS data files
Example code for SAS and SUDAAN

The programs:
produce estimates published in the 2005 MMWR Surveillance Summary for oral health
are written for SAS and SAS-callable SUDAAN
were tested using SAS v8.2 with SAS-callable SUDAAN 9.0.1

Considerations: 
These programs are written for novice SAS and SUDAAN users and do not use macros, thus they are not optimized to conserve computing resources.  The SAS-callable SUDAAN code blocks (beginning "proc crosstab" and "proc descript") ran very slowly in testing.  For examples of programs that use macros, consult a SAS user's manual or text book, or see the example program "SAS_SUD99.sas" on the BRFSS Web site under Data and Technical Info, 1999, SAS Resources.  Macros will reduce the running time considerably.  Running the programs a block at a time will help in identifying issues with different software versions or individual user set-ups.

Programs to create estimates published in the MMWR Surveillance Summary
(see General Notes about running these programs)

Back to top

Transport programs (create SAS data files from the SAS Transport files provided on NCHS Web site)
Data management programs (combine data files from 1999-2000 and 2001-2002 by data chapter)
Variable creation programs (create variables used in MMWR Surveillance Summary analysis programs)
Analysis programs (create estimates published in the MMWR Surveillance Summary)


Transport programs

Programs to convert data files provided on NCHS Web site to SAS data files
(see General Notes about running these programs)

Back to top

Year Program
Click to open program in new window.
To download, right-click and choose "Save Target as."
Notes
1988-1994   Adult
    Youth
    Exam
    Combined


Data management programs

Chapter Program Notes
Demographics demoAB.sas

DEMOAB creates compatible variable names and combines the 1999-2000 and 2001-2002 data into a 4-year data set

Oral Health Questionnaire ohqAB.sas

OHQAB creates compatible variable names and combines the 1999-2000 and 2001-2002 data into a 4-year data set

Dentition ohxdenAB.sas

OHXDENAB creates compatible variable names and combines the 1999-2000 and 2001-2002 data into a 4-year data set

Periodontal ohxperAB.sas

OHXPERAB creates compatible variable names and combines the 1999-2000 and 2001-2002 data into a 4-year data set

Oral Health recommendations and referrals ohxrefAB.sas

OHXREFAB creates compatible variable names and combines the 1999-2000 and 2001-2002 data into a 4-year data set

Smoking sample person questionnaire smqAB.sas

SMQAB creates compatible variable names and combines the 1999-2000 and 2001-2002 data into a 4-year data set


Variable creation programs

Variable set Program Notes
Demographics nh3demo.sas

Creates variables for demographic groupings used in the MMWR surveillance summary for age groups, sex, race/ethnicity, poverty groups, education, smoking

Age/Sex adjustment nh3agestd.sas

Creates variables for age and age/sex standardization used in the MMWR surveillance summary

Caries (tooth decay, DMF indices), tooth retention and tooth loss nh3dent.sas

Creates variables for prevalence of dental caries, untreated tooth decay, dt, ft, dft, ds, fs, dfs, DT, MT, FT, DFT, DMFT, DS, MS, FS, DFS, DMFS, percent contribution of ds and fs to dfs, percent contribution of DS and FS to DFS, number of teeth and tooth loss

Dental sealants nh3seal.sas

Creates variables for prevalence of dental sealants, number of dental sealants on permanent teeth and number of dental sealants by tooth type

Smoking nh3smoke.sas

Creates variable for smoking history groups (current, former, never)

MMWR Surveillance Summary nh3mmwr.sas

NH3MMWR combines the data sets output from the variable creation programs above into an analysis data set used in the analysis programs listed below.


Analysis programs

Topic
(Table numbers from MMWR Surveillance Summary)
Program Notes
separate programs into NH4 and NH3 sections
Caries (tooth decay) in primary teeth
(Tables 2-6)
Caries (tooth decay) in permanent teeth in children and adolescents
(Tables 7-11)
carieschild.sas

Creates estimates among children aged 2 to 11 years for prevalence of caries experience (treated and untreated) and untreated tooth decay, mean dft, dt, ft, dfs, ds, fs, and percent contribution of ds and fs to the dfs score, in the primary teeth
Creates estimates among children and adolescents aged 6 to 19 years for prevalence of caries experience (treated and untreated) and untreated tooth decay, mean DMFT, DT, MT, FT, DMFS, DS, MS, FS, and percent contribution of DS, MS, and FS to the DMFS score, in the permanent teeth

Dental sealants
(Tables 12-14)
sealants.sas

Creates estimates among children and adolescents aged 6 to 19 years for prevalence of dental sealants, mean number of teeth with dental sealants among those with at least 1 sealed tooth, and mean number of sealants by tooth type, in permanent teeth

Caries (tooth decay) in permanent teeth in adults
(Tables 15-22)
cariesadult.sas

Creates estimates among adults aged 20 years and older for prevalence of caries experience (treated and untreated) and untreated tooth decay, mean DMFT, DFT, DT, MT, FT, DMFS, DFS, DS, MS, FS, and percent contribution of DS, and FS to the DFS score, prevalence of treated and untreated root caries,  in permanent teeth

Tooth loss and retention toothloss.sas

Creates estimates among adults aged 20 years and older for mean number of permanent teeth, and prevalence of edentulism (complete tooth loss)

Enamel fluorosis
(Table 23)
fluorosis.sas

Creates estimates among children, adolescents and adults aged 6 to 39 years for prevalence of each level of enamel fluorosis, in permanent teeth

 

Example code for SAS and SUDAAN

Back to top

Example code to convert a SAS transport data file (file extension ".xpt") to a SAS data file (file extension .sas7bdat or .sd7)

Replace with examples from NHANES

/*Program Name: BRFSS2004_xpt.sas*/
/*create SAS v8 file from SAS xport file*/
/*for BRFSS 2004*/
/*07/15/2005*/
LIBNAME BRF04IN XPORT "C:/BRFSS/BRFSS2004/SASXPORT/cdbrfs04.xpt";
libname  BRF04OUT v8 "C:/BRFSS/BRFSS2004/SASV8";
  PROC COPY IN=BRF04IN OUT=BRF04OUT;
  RUN;
/*end BRFSS2004_xpt.sas*/

In the SAS enhanced editor, it will look like this:
(Comments written to document the program appear in green between special symbols "/*" and "*/", or between "*" and ";".):

/*Program Name: BRFSS2004_xpt.sas*/
/*create SAS v8 file from SAS xport file*/
/*for BRFSS 2004*/
/*07/15/2005*/

LIBNAME
BRF04IN XPORT "C:/BRFSS/BRFSS2004/SASXPORT/cdbrfs04.xpt";
libname
BRF04OUT v8 "C:/BRFSS/BRFSS2004/SASV8";
PROC COPY IN=BRF04IN OUT=BRF04OUT;
RUN;
/*end BRFSS2004_xpt.sas*/

Example SAS Data step to recode a variable

Data Brf04ss.BRFDOH04; *write out data set;
set Brf04ss.cdbrfs04;  *read in data set;

*Age groups - 18 and older in 6 groups;
if age in (7,9) then agegrp = . ; *refused, did not respond, missing omitted;
else if 18 <= age <= 24 then agegrp = 1 ; *18 to 24 years;
else if 25 <= age <= 34 then agegrp = 2 ; *25 to 34 years;
else if 35 <= age <= 44 then agegrp = 3 ; *35 to 44 years;
else if 45 <= age <= 54 then agegrp = 4 ; *45 to 54 years;
else if 55 <= age <= 64 then agegrp = 5 ; *55 to 64 years;
else if age ge 65 then agegrp = 6 ; *65 years and older;

RUN;

Example SUDAAN Code block to produce estimates for Past year dental visits for all states, by several demographic groupings

*Table for 2004 Dental visits: 18 and older - Not age adjusted;

Proc
crosstab Data = Brf04ss.BRFDOH04 design=wr filetype=sas CONF_LIM=95;
 Nest _ststr _psu/missunit;
 Weight _finalwt;

 Subpopn agegrp >=
1 and _finalwt>0;
 
Class _state;
 Subgroup visit sex agegrp racegrp income educat ;
 Levels    
2    2    6       5       5     4    ;

 Tables _state*visit
       (sex income educat racegrp agegrp)*_state*visit;

 Print nsum rowper lowrow uprow/ rowperfmt=
f5.1 lowrowfmt=f5.1 uprowfmt=f5.1 style=nchs;
 output nsum rowper lowrow uprow/ filename=brf04ss.vis04 REPLACE filetype=SAS;

 rtitle
"NOHSS 2005 release - BRFSS 2004 Estimates for Dental Visits - not age adjusted";

Run
;
 

General notes about running these programs:

Back to top

Need to have SAS and SAS-callable SUDAAN installed either on local machine or have access to these programs through a network (See About SAS and SAS-callable SUDAAN).  The SAS-callable SUDAAN code in these programs can be copied into a separate file and edited to run in SUDAAN.

Libname BRF99SS 'C:\BRFSS\BRFSS1999\SASV8'; /*Location of SAS version of data set*/
Libname OUT 'C:\BRFSS\BRFSS1999\OUT'; /*Location to save output data sets*/
 

Libname LIBRARY 'C:\BRFSS\BRFSS1999\SASV8'; /*Formats library*/

If you don't want to save permanent formats: 

delete this statement
Libname
LIBRARY 'C:\BRFSS\BRFSS1999\SASV8'; /*Formats library*/

and change this statement
*Formats;

Proc
Format library=LIBRARY; *creates permanent format library;

to this statement
*Formats;

Proc
Format ; *creates temporary format library;
 

*Exporting file to Excel;
Proc
Export Data = Brf97ss.CDIInd92_1997
Outfile = "Q:\BRFSS\Brfss1997\ExcelTables\CDIInd92_1997.xls"
DBMS = Excel2000 Replace;
Run
;