Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

NHANES Variable Search: Research Data Guide

Search CDC NHANES variables, interpret online codebooks, download XPT files, merge by SEQN, and apply survey weights correctly for secondary data analysis.

Written and maintained by CASRAI Editorial Board

Last updated

The National Health and Nutrition Examination Survey (NHANES), conducted by the National Center for Health Statistics (NCHS) within the Centers for Disease Control and Prevention (CDC), is a foundational population health resource. For researchers in public health and epidemiology, conducting an NHANES variable search is the critical entry point for designing secondary data analyses. Finding the right variables, reading their codebooks, and applying the correct survey weights are the steps that decide whether an analysis is valid.

What it is used for in research

Conducting an NHANES variable search enables investigators to locate specific biometric measurements, biomarker assays, dietary recalls, and questionnaire responses collected across continuous two-year survey cycles from 1999 to the present. Researchers rely on the search interface to identify variable availability across cycles, inspect questionnaire wording, check clinical target populations, and evaluate laboratory methodology shifts before undertaking empirical modeling.

In rigorous secondary data analysis, variable discovery directly informs study feasibility. Researchers determine whether a biomarker was administered to the entire sample or restricted to a fasting subsample, confirming sample sizes required for statistical power.

Install or access

The official Continuous NHANES Variable Search tool is a publicly accessible web utility maintained by the CDC and NCHS. It requires no software installation, account creation, or user authentication for public-use data files. Researchers access the search interface directly through the CDC portal at wwwn.cdc.gov/nchs/nhanes/search/default.aspx.

For programmatic data retrieval and automated codebook queries within analytical environments, researchers frequently install open-source statistical packages that interface with CDC endpoints:

  • R Environment: Install the CRAN package nhanesA using install.packages("nhanesA"), alongside the complex survey analysis package survey using install.packages("survey").
  • Python Environment: Install data extraction and survey analysis libraries via pip install pandas pyreadstat statsmodels.
  • Stata and SAS: SAS and Stata include native engines for SAS transport files (e.g., import sasxport5 in Stata or LIBNAME xport in SAS).

Step-by-step task

Locating variables, downloading data tables, and preparing an analytical NHANES dataset follows a standardized five-stage workflow:

1. Execute Keyword Search in the CDC Web Tool

Open the Continuous NHANES Variable Search page. Enter your search query (such as “glycohemoglobin”, “blood pressure”, or “cotinine”) into the Search Term box; quoted phrases are supported. Under “Fields to Search”, choose “All”, “Data File Name”, “SAS Label”, “Variable Description”, or “Variable Name”. Use the “Release Cycle” list to restrict results to one release (e.g., 2017-2018) or search all cycles, and use the “Limited Access” option (Include, Exclude, or Only) to control whether limited-access variables appear.

2. Inspect the Variable Documentation and Codebook

Click on the variable result to view its integrated web codebook. Note the following essential metadata elements:

  • Variable Name: The alphanumeric identifier used in data files (e.g., RIDAGEYR for age, LBXGH for glycohemoglobin).
  • Data File Name: The dataset table housing the variable (e.g., DEMO for demographics, GHB_J for 2017–2018 glycohemoglobin).
  • Target Population: The demographic criteria defining eligibility for the question or measurement (e.g., “Participants 12 years and older”).
  • Code Values and Frequencies: The mapping of categorical codes to descriptions, with counts, including the codes used for non-response and skipped questions.

3. Download SAS Transport (.XPT) Data Files

Navigate to the identified data component page (Demographics, Dietary, Examination, Laboratory, or Questionnaire). Download the corresponding .XPT data files for your chosen cycle. At minimum, every analysis requires the Demographic Variables file (e.g., DEMO_J.XPT) to obtain survey weights and design variables.

4. Import and Merge Datasets by SEQN

In your statistical software, load the downloaded files and merge them using the unique participant identifier, SEQN (Respondent sequence number). In R, use haven::read_xpt() or nhanesA::nhanes():

library(haven)
library(dplyr)

demo <- read_xpt("DEMO_J.XPT")
ghb  <- read_xpt("GHB_J.XPT")

# Merge one-to-one on respondent sequence number
analytic_data <- inner_join(demo, ghb, by = "SEQN")

5. Specify Complex Survey Design and Weights

NHANES is based on a multistage sampling design involving clustering, stratification, and unequal probabilities of selection. Analyses should use the survey weights and design variables rather than treating the data as a simple random sample. In R, configure the survey design object using the survey package, specifying the primary sampling unit (SDMVPSU), stratum (SDMVSTRA), and appropriate survey weight:

library(survey)

# Construct complex survey design object using MEC exam weight
nhanes_design <- svydesign(
  id = ~SDMVPSU,
  strata = ~SDMVSTRA,
  weights = ~WTMEC2YR,
  nest = TRUE,
  data = analytic_data
)

Output and how to read it

When reviewing variable search output and codebook tables on the CDC portal, each variable display includes these components:

  • SAS Label: A short label describing the measure, searchable in the tool.
  • English Text: The questionnaire wording or measurement description for the variable.
  • Target: The subpopulation the question or measurement applies to. Checking it avoids treating people who were never asked as non-responders.
  • Codebook Table: A breakdown of each code value, its description, and the count of respondents, with skip patterns noted.
  • Special Values: Read the codebook for each variable to see which codes mark refused, don’t know, or missing responses before recoding them.

Troubleshooting

Researchers conducting secondary data analyses with NHANES data frequently encounter common analytical traps. Apply the following solutions:

  • Mismatched Sample Weights: Choosing between the interview weight (WTINT2YR) and the examination weight (WTMEC2YR) depends on the most restrictive component in your model. If an analysis includes any measure from the Mobile Examination Center (physical exams or laboratory tests), you must use WTMEC2YR.
  • Subsample Weight Selection: If a biomarker was evaluated only on a morning fasting subsample (e.g., fasting plasma glucose), you must use the specific fasting subsample weight (e.g., WTSAF2YR) located within that laboratory file, not the demographic file’s MEC weight. When combining variables from different subsamples, follow the CDC guideline: apply the weight corresponding to the smallest subsample.
  • Merging Multi-Record Files: While demographics and standard lab files have exactly one row per SEQN, dietary individual foods files (DR1IFF) and prescription medication files (RXQ_RX) contain multiple rows per participant. Merging them directly with demographic files creates Cartesian row multiplication. Always aggregate or reshape multi-record files to the individual level before merging by SEQN.
  • Restricted and Limited-Access Variables: Some variables are flagged as limited access in the search tool and are not part of the public-use files; the NCHS Research Data Center is the route for such data. Institutions generally govern shared data through a data use agreement, and the NCHS conditions for any restricted file apply.
  • Reporting Standards Compliance: Observational studies utilizing NHANES data should adhere to the STROBE checklist guidelines, explicitly detailing sampling design variables, weight selection, and software variance estimation procedures in the methodology section.

Free alternatives

Several free tools cover the same tasks as the CDC web search, and they can be combined.

Tool Environment What it does for NHANES work
CDC Continuous NHANES Variable Search Web browser Keyword search over data file names, SAS labels, variable descriptions, and variable names, with release-cycle and limited-access filters
nhanesA R (CRAN) Programmatic retrieval of NHANES tables from within R
survey R (CRAN) Complex survey design objects using svydesign with strata, clusters, and weights
pandas and pyreadstat Python Reading SAS transport (.XPT) files and merging tables by SEQN

FAQ

Where can I find the official NHANES variable search tool?

The Continuous NHANES Variable Search tool is located on the CDC/NCHS website at wwwn.cdc.gov/nchs/nhanes/search/default.aspx. It covers all continuous survey releases from 1999 to the present.

What does SEQN stand for in NHANES datasets?

SEQN stands for Respondent Sequence Number. It is a unique, anonymous numeric identifier assigned to each participant in a given survey cycle and serves as the primary key for merging demographic, examination, laboratory, and questionnaire files.

Which survey weight should I choose for my NHANES analysis?

Select the survey weight that corresponds to the most restrictive variable in your model. Use the interview weight (WTINT2YR) only if all variables originate from the home interview questionnaire. Use the Mobile Examination Center weight (WTMEC2YR) if any variable comes from physical examinations or standard lab tests. If analyzing specialized laboratory assays (such as fasting glucose or environmental chemicals), use the specific subsample weight provided in that dataset file.

In what format are NHANES datasets distributed?

Continuous NHANES public-use data files are distributed as SAS transport files with a .XPT extension. These files can be opened and parsed in R (using haven::read_xpt), Python (using pandas.read_sas), Stata (using import sasxport5), and SAS.

Sources

All sources checked 2026-11-07.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about NHANES Variable Search: Research Data Guide

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →