Microproduct data guideintermediate

NHANES Public Data Files

Cycle-based examination, laboratory, and questionnaire files for building nutrition and health-survey prototypes from public NHANES tables.

At a glance

Difficulty
Intermediate — some data preparation helps
Size
Medium · 0.01–2 GB
Formats
XPT, CSV
Access
Download
API key
Not required
Provider
National Center for Health Statistics
Updates
Occasional

From source to product signal

Test a product idea in four steps

NHANES public files include demographics, examination, and lab tables by cycle. Start with one cycle's demographics XPT. Unweighted row counts are not national estimates; use interview weights, and do not treat a cycle extract as clinical diagnosis data.

1

Check the setup

  • Python 3.10 or newer
  • A notebook environment such as Jupyter or Google Colab
  • An internet connection
2

Access the data

  1. 1.Open the NHANES page and choose one public cycle such as 2021-2023.
  2. 2.Download the demographics XPT file.
  3. 3.Keep sequence number, interview weight, age, and sex.
Open official source
3

Run the Python example

Install the packages, then run the notebook cell.

python -m pip install pandas pyreadstat requests

import pandas as pd
import pyreadstat
import requests
from io import BytesIO

response = requests.get(
    "https://wwwn.cdc.gov/Nchs/Nhanes/2021-2023/DEMO_L.xpt",
    timeout=60,
)
response.raise_for_status()
demographics, _meta = pyreadstat.read_xport(BytesIO(response.content))
print(demographics.head())
4

Test a useful signal

Describe one NHANES demographics file

Test whether a public cycle file can power a bounded survey-profile sketch.

  1. 01Keep sequence number, interview weight, age, and sex from the demographics table.
  2. 02Compare unweighted counts with a weighted age summary using the interview weight.
  3. 03Explain that unweighted rows are not U.S. prevalence estimates and that NHANES is not a diagnostic file.

Dataset details

National Center for Health Statistics is a government source. Last verified 2026-08-18. Temporal coverage: NHANES cycles from 1999-present with two-year public files.

Theme

Health, Food & Safety

Domains

Public HealthNutritionSurvey Research

Data types

Survey MicrodataTabular

Tasks

Health Survey AnalysisNutrition ResearchPrevalence Estimation

Geography

United States

Formats

XPTCSV

Provider

National Center for Health Statistics

Data terms

U.S. Public Domain with CDC attribution and use requirements