Below is a listing of all the sample code and datasets used in the Continuous NHANES tutorial. They are organized by module and then task. If a module or task is not listed it is because it did not have a related program. Programs are available as SAS programs (i.e. SAS Survey Procedures and SAS-callable SUDAAN) and Stata programs. The datasets are SAS or Stata datasets for Windows.
These datasets are intended to be used with the tutorial only, as they may contain a subset of the variables available. If you wish to conduct your own analyses, please download the most current and complete datasets from the NHANES website.
Program code used in this tutorial follow procedures available in SAS 9.1, SAS 8.0 and SUDAAN 9.0 or SUDAAN 8.0, and Stata/SE 10.0.
These programs use variable formats listed in the Tutorial Formats page. You may need to format the variables in your dataset the same way to reproduce results presented in the tutorial.
A regular left-click may not download the SAS datasets or SAS code correctly. Your browser may try to open and attempt to interpret the contents of the dataset or program. If this happens, right-click the link and save the dataset or program to your hard drive. After it has downloaded, the use your statistical software program to open the dataset to view it.
Download Data Files
- Task 3: How to Extract and Copy NHANES Data Files to Permanent Libraries
- Task 3c: How to Import and Save NHANES Data Files in Stata
Append & Merge Datasets
-
Zip file of all programs and datasets for this module
- Task 1: How to Append NHANES Data
- Step 1: Check Contents of Datasets
- Step 2: Append Directly, if Contents are the Same
- 1999-2000 Demographic Dataset
- 2001-2002 Demographic Dataset
- 1999-2000 Blood Pressure Dataset
- 2001-2002 Blood Pressure Dataset
- 1999-2000 Blood Pressure Questionnaire Dataset
- 2001-2002 Blood Pressure Questionnaire Dataset
- 1999-2000 Medical Conditions Questionnaire Dataset
- 2001-2002 Medical Conditions Questionnaire Dataset
- 1999-2000 Lab 13 Dataset
- 2001-2002 Lab 13 Dataset
-
Program to
Directly Append
- Step 3: Rename Variables and then Append
- Task 2: How to Merge NHANES Data
- Task 1c and 2c: How Append & Merge NHANES Data in Stata
- Program to Append & Merge Datasets
- 1999-2000 Alcohol Questionnaire Dataset
- 2001-2002 Alcohol Questionnaire Dataset
- 1999-2000 Blood Pressure Questionnaire Dataset
- 2001-2002 Blood Pressure Questionnaire Dataset
- 1999-2000 Medical Conditions Questionnaire Dataset
- 2001-2002 Medical Conditions Questionnaire Dataset
- 1999-2000 Blood Pressure Examination Dataset
- 2001-2002 Blood Pressure Examination Dataset
- 1999-2000 Lab 13 Dataset
- 2001-2002 Lab 13 Dataset
- 1999-2000 Demographics Dataset
- 2001-2002 Demographics Dataset
- 4-year Alcohol Questionnaire Dataset
- 4-year Blood Pressure Questionnaire Dataset
- 4-year Medical Conditions Questionnaire Dataset
- 4-year Blood Pressure Examination Dataset
- 4-year Lab 13 Dataset
- 4-year Demographic Dataset
Clean & Recode Data
-
Zip file of all programs, output, and datasets for this
module
- Task 1: How to Identify and Recode Missing Data
- Step 1: Identify Missing and Unavailable Values
- Step 2: Recode Unavailable Values as Missing
- Step 3: Evaluate Extent of Missing Data
- Task 2: How to Identify and Recode Skip Patterns in
NHANES Data
- Step 2: Check Data for Skip Patterns
- Step 3: Recode Skip Pattern
- Task 3: How to Identify Outliers and Evaluate Their Impact
- Step 1: Check Distributions
- Step 2: Plot Graph of Survey Weight Against Distribution of Variable
- Step 3: Identify Outliers and Compare Estimate with and without Outliers
- Task 4: How to Create Derived Variables from NHANES Data
-
Step 1: Recode Based on Alternate Definitions
- Step 2: Check Derived Variables
-
Step 1: Recode Based on Alternate Definitions
- Task 1c, 2c, 3c, and 4c: How Clean & Recode NHANES Data in Stata
Format & Label Variables
-
Zip file of all programs and datasets for this module
- Task 1: How to Format and Label NHANES Variables
- Task 1c: How Format & Label NHANES Data in Stata
Save Datasets
-
Zip file of all program and datasets for this module
- Task 1: How to Save Datasets
- Task 1c: How Save NHANES Data in Stata
Variance Estimation
- Task 3: How to Calculate Degrees of Freedom for Performing Statistical Tests and Confidence Limits
Descriptive Statistics
- Task 1a: Check Frequency Distribution and Normality
- Step 1: Use the univariate procedure to generate descriptive statistics in SAS
- Step 3: Request selective statistics and output results to SAS dataset
- Task 1c: How to Check Frequency Distribution and Normality in Stata
- Step 1: Use the summarize command to generate weighted summary statistics for a population subset
- Step 3: Use tabstat to request selective statistics
- Task 2: Generate Percentiles
- Task 3a: Generate Means Using SUDAAN
- Step 1: Use proc descript to Generate Means in SUDAAN
- Dataset
- Program to Generate Means in SUDAAN
- Output of Program to Generate Means in SUDAAN
- Program to Generate Means in SAS Survey Procedures
- Output of Program
to Generate Means in SAS Survey Procedures
- Step 4: Use proc descript to Generate Geometric Means in SUDAAN
- Task 3b: Generate Means Using SAS Survey Procedures
- Task 3c: Generate Means Using Stata
- Step 2: Use svy:mean to generate means and standard errors in Stata
- Task 4a: Generate Proportions Using SUDAAN
- Task 4b: Generate Proportions Using SAS Survey Procedures
- Task 4c: Generate Proportions Using Stata
Hypothesis Testing
- Task 1a: Set Up a t-test in NHANES Using SUDAAN
- Step 1: Set Up SUDAAN to Produce Means
- Step 3: Perform t-test to Test for Significance
- Task 1b: Set Up a t-test in NHANES Using SAS Survey Procedures 9.1
- Step 2: Set Up SAS Survey Procedures to Produce Means
- Step 4: Perform t-test to Test for Significance (SAS Survey Procedures 9.1)
- Dataset
- Program to Test for Significance in SAS Survey Procedures 9.1
- Output of
Program to Produce t-test in SAS Survey Procedures 9.1
- Step 4: Perform t-test to Test for Significance (SAS Survey Procedures 9.2)
- Task 3b: Perform Chi-Square Test Using SAS Survey Procedures
- Task 3c: Perform Chi-Square Test Using Stata
Age Standardization and Population Counts
- Task 1a: How to Generate Age-Adjusted Prevalence Rates in
SUDAAN
- Step 1: How to Generate Age-Adjusted Prevalence Rates in SUDAAN
- Optional Step 2: How to Generate Age-Adjusted Means
- Task 1b: How to Generate Age-Adjusted Prevalence
Rates in SAS Survey Procedures
- Step 1: How to Generate Age-Adjusted Prevalence Rates in SAS Survey Procedures 9.1
- Step 1: How to Generate Age-Adjusted Prevalence Rates in SAS Survey Procedures 9.2
- Optional Step 2: How to Generate Age-Adjusted Means in SAS Survey Procedures 9.1
- Optional Step 2: How to Generate Age-Adjusted Means in SAS Survey Procedures 9.2
- Step 1: How to Generate Age-Adjusted Prevalence Rates in Stata
- Dataset
- Standard Proportions for NHANES Population Groupings
- Program to Generate Age-Adjusted Prevalence Rates in Stata
- Output of Program to Generate Age-Adjusted Prevalence Rates in Stata
- Optional Step 2: How to Generate Age-Adjusted Means in Stata
Linear Regression
- Task 2a: Set Up Linear Regression using SUDAAN
- Task 2b: Set Up Linear Regression using SAS Survey Procedures 9.1
- Task 2b: Set Up Linear Regression using SAS Survey Procedures 9.2
- Task 2c: Set Up Linear Regression using Stata
Logistic Regression
- Task 2a: How to Use SUDAAN Code to Perform Logistic Regression
- Step 1: SUDAAN Univariate Logistic Regression
- Dataset
- Program to Perform Univariate Logistic Regression
- Output of Program to Perform Univariate Logistic Regression
- Step 3: SUDAAN Multivariate Logistic Regression
- Dataset
- Program to Perform Multivariate Logistic Regression
- Output of Program to Perform Multivariate Logistic Regression
- Task 2b: How to Use SAS Survey Procedures 9.1 to Perform Logistic Regression
- Task 2b: How to Use SAS Survey Procedures 9.2 to Perform Logistic Regression
- Task 2c: How to Use Stata Code to Perform Logistic Regression
To report problems or comments, use the NHANES Web Tutorial email. Do not direct questions to this email address, as it can only receive feedback and we will not be able to reply.
Contact Us:
- National Center for Health Statistics
3311 Toledo Rd
Hyattsville, MD 20782 - 1 (800) 232-4636
- cdcinfo@cdc.gov

