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.

Report a Problem

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
Last Verified
Aug 18, 2026
Source Type
Government Source
  • Python Syntax Checked

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.

Geography

Formats

Provider

National Center for Health Statistics

Data Terms

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

Send Feedback