VARIABLE MAP

NHANES variable map — the reproduction’s own crosswalk

Generated by R/07_variable_map.R from the files in data/raw/. Do not edit by hand. Cycle availability, labels and missing-value conventions below were read out of the .xpt files, not copied from documentation.

Every variable this reproduction touches, and for each one the four things students most often get wrong:

  1. Where it lives — which component file, and therefore which download
  2. What its raw codes mean — and whether a 77-looking value is a code or a measurement
  3. Whether it exists in every cycle — several do not
  4. What we did to it — the line in our pipeline that reads or transforms it

This page is a method, not just an answer. When you meet an unfamiliar NHANES variable in your own paper, these are the questions to ask of it, in this order. The loop runs: paper sentence → operational concept → NHANES variable → component → that cycle’s codebook → raw .xpt → your implementation → cohort consequence.

Three different kinds of link, which are easy to conflate:

Link Goes to Use it when
codebook the CDC documentation page, anchored at that variable you need the official definition, the value labels, or the frequencies
.xpt the raw data file for that cycle you are downloading it yourself
our code the line in this pipeline that reads or derives it you want to see what we did, and disagree with it

Cycle letters: E 2007-08 · F 2009-10 · G 2011-12 · H 2013-14 · I 2015-16 · J 2017-18. The file name carries the suffix (BMX_H.xpt); the variable name inside usually does not (BMXBMI in every cycle).


Join key

Concept Variable Component Cycles Label (from the file) Missing convention Links
Respondent ID SEQN DEMO all six Respondent sequence number NA only codebook · .xpt · R/02_build_analytic.R:48

Eligibility

Concept Variable Component Cycles Label (from the file) Missing convention Links
Age RIDAGEYR DEMO all six Age at Screening Adjudicated - Recode NA only — 7, 9, 77 are real values (n=1282, 1258, 300): do not strip codebook · .xpt · R/02_build_analytic.R:56

Survey design

Concept Variable Component Cycles Label (from the file) Missing convention Links
MEC weight WTMEC2YR DEMO all six Full Sample 2 Year MEC Exam Weight NA only codebook · .xpt · R/02_build_analytic.R:57
Interview weight WTINT2YR DEMO all six Full Sample 2 Year Interview Weight NA only codebook · .xpt · R/02_build_analytic.R:57
Cycle indicator SDDSRVYR DEMO all six Data Release Number NA only — 7, 9 are real values (n=9756, 9971): do not strip codebook · .xpt · R/02_build_analytic.R:57
Fasting subsample weight WTSAF2YR TRIGLY all six Fasting Subsample 2 Year MEC Weight ⚠ NA only codebook · .xpt · R/02_build_analytic.R:61
Stratum SDMVSTRA DEMO all six Masked Variance Pseudo-Stratum NA only — 77, 99 are real values (n=823, 682): do not strip codebook · .xpt · R/02_build_analytic.R:57
PSU SDMVPSU DEMO all six Masked Variance Pseudo-PSU NA only codebook · .xpt · R/02_build_analytic.R:57

⚠ WTSAF2YR — A design variable living in a laboratory file. Build the survey design on the full frame, then subset() - never on the subsample alone.

Case definition (FLI)

Concept Variable Component Cycles Label (from the file) Missing convention Links
Triglycerides LBXTR TRIGLY all six Triglyceride (mg/dL) NA only — 77, 99 are real values (n=152, 117): do not strip codebook · .xpt · R/00_setup.R:52
BMI BMXBMI BMX all six Body Mass Index (kg/m**2) NA only codebook · .xpt · R/02_build_analytic.R:58
GGT LBXSGTSI BIOPRO all six Gamma glutamyl transferase (U/L) NA only — 7, 9, 77, 99 are real values (n=519, 1228, 27, 14): do not strip codebook · .xpt · R/00_setup.R:53
Waist circumference BMXWAIST BMX all six Waist Circumference (cm) NA only — 77, 99 are real values (n=119, 132): do not strip codebook · .xpt · R/02_build_analytic.R:58

Cardiometabolic 1 (adiposity)

Concept Variable Component Cycles Label (from the file) Missing convention Links
BMI BMXBMI BMX all six Body Mass Index (kg/m**2) NA only codebook · .xpt · R/02_build_analytic.R:58
Waist circumference BMXWAIST BMX all six Waist Circumference (cm) NA only — 77, 99 are real values (n=119, 132): do not strip codebook · .xpt · R/02_build_analytic.R:58

Cardiometabolic 2 (glycaemia)

Concept Variable Component Cycles Label (from the file) Missing convention Links
Fasting glucose LBXGLU GLU all six Fasting Glucose (mg/dL) NA only — 77, 99 are real values (n=50, 709): do not strip codebook · .xpt · R/00_setup.R:55
HbA1c LBXGH GHB all six Glycohemoglobin (%) NA only — 7, 9 are real values (n=173, 26): do not strip codebook · .xpt · R/00_setup.R:54
Diabetes diagnosis DIQ010 DIQ all six Doctor told you have diabetes reserved 7, 9 (n=3, 32) — strip before any rule codebook · .xpt · R/02_build_analytic.R:70
Insulin DIQ050 DIQ all six Taking insulin now reserved 7, 9 (n=4, 5) — strip before any rule codebook · .xpt · R/02_build_analytic.R:70
Oral hypoglycaemics DIQ070 DIQ FGHIJ only Take diabetic pills to lower blood sugar reserved 7, 9 (n=1, 10) — strip before any rule codebook · .xpt · R/02_build_analytic.R:70

Cardiometabolic 3 (blood pressure)

Concept Variable Component Cycles Label (from the file) Missing convention Links
Systolic (reading 1 of 4) BPXSY1 BPX all six Systolic: Blood pres (1st rdg) mm Hg NA only codebook · .xpt · R/02_build_analytic.R:59
Diastolic (reading 1 of 4) BPXDI1 BPX all six Diastolic: Blood pres (1st rdg) mm Hg ⚠ NA only codebook · .xpt · R/02_build_analytic.R:60
On BP medication BPQ050A BPQ all six Now taking prescribed medicine for HBP reserved 9 (n=3) — strip before any rule codebook · .xpt · R/02_build_analytic.R:69

⚠ BPXDI1 — A diastolic reading of 0 is a measurement. NHANES records a failure to obtain a reading as NA, separately. Do not na_if(., 0).

Cardiometabolic 4 (triglycerides)

Concept Variable Component Cycles Label (from the file) Missing convention Links
Triglycerides LBXTR TRIGLY all six Triglyceride (mg/dL) NA only — 77, 99 are real values (n=152, 117): do not strip codebook · .xpt · R/00_setup.R:52
On lipid medication BPQ100D BPQ all six Now taking prescribed medicine reserved 9 (n=14) — strip before any rule codebook · .xpt · R/02_build_analytic.R:69

Cardiometabolic 5 (HDL)

Concept Variable Component Cycles Label (from the file) Missing convention Links
HDL cholesterol LBDHDD HDL all six Direct HDL-Cholesterol (mg/dL) NA only — 7, 77, 99 are real values (n=1, 255, 32): do not strip codebook · .xpt · R/00_setup.R:56

Exposure

Concept Variable Component Cycles Label (from the file) Missing convention Links
Height (for WHtR) BMXHT BMX all six Standing Height (cm) NA only — 99 is a real value (n=16): do not strip codebook · .xpt · R/02_build_analytic.R:58
Race/ethnicity (Asian BMI cut) RIDRETH3 DEMO GHIJ only Race/Hispanic origin w/ NH Asian ⚠ NA only — 7 is a real value (n=1996): do not strip codebook · .xpt · R/02_build_analytic.R:56

⚠ RIDRETH3 — This is what identifies Asian participants for the paper’s lower BMI threshold - so the rule cannot be applied in 2007-2010 at all.

Alcohol exclusion

Concept Variable Component Cycles Label (from the file) Missing convention Links
Drinks per drinking day ALQ130 ALQ all six Avg # alcoholic drinks/day -past 12 mos ⚠ reserved 777, 999 (n=3, 28) — strip before any rule, but 7, 9 are real values (n=197, 47): do not strip codebook · .xpt · R/02_build_analytic.R:67
Drinking frequency (quantity) ALQ120Q ALQ EFGHI only How often drink alcohol over past 12 mos reserved 777, 999 (n=2, 25) — strip before any rule, but 7, 9 are real values (n=1146, 17): do not strip codebook · .xpt · R/02_build_analytic.R:67
Drinking frequency (unit) ALQ120U ALQ EFGHI only # days drink alcohol per wk, mo, yr NA only codebook · .xpt · R/02_build_analytic.R:67
Drinking frequency (2017-18 redesign) ALQ121 ALQ J only Past 12 mo how often have alcohol drink ⚠ reserved 77, 99 (n=2, 2) — strip before any rule, but 7, 9 are real values (n=351, 476): do not strip codebook · .xpt · R/02_build_analytic.R:67

⚠ ALQ130 — CDC’s SAS Label reads “Avg # alcohol drinks/day - past 12 mos”. CDC’s English Text for the same variable reads “During the past 12 months, on those days that {you} drank alcoholic beverages, on the average, how many drinks did {you} have?” — that is drinks per drinking day. Applying a per-day threshold to it directly over-excludes ~2,000 people here; average intake needs frequency x quantity. The short label is not the question. Read the English Text, every time.

⚠ ALQ121 — Its reserved codes are 77 (Refused) and 99 (Don’t know), not the 777/999 used by ALQ130 — a rule hard-coded to c(777, 999) misses them. And 7 and 9 are ordinary answers here: 7 = “Once a month”, 9 = “3 to 6 times in the last year”. CDC’s own Analytic Notes state “ALQ120Q and ALQ120U became ALQ121” in 2017-18, so this is an instrument change, not a missing column.

Covariate

Concept Variable Component Cycles Label (from the file) Missing convention Links
Sex RIAGENDR DEMO all six Gender NA only codebook · .xpt · R/02_build_analytic.R:56
Race/ethnicity (all cycles) RIDRETH1 DEMO all six Race/Ethnicity - Recode NA only codebook · .xpt · R/02_build_analytic.R:56
Income-to-poverty ratio INDFMPIR DEMO all six Ratio of family income to poverty NA only codebook · .xpt · R/02_build_analytic.R:57
Ever smoked 100 cigarettes SMQ020 SMQ all six Smoked at least 100 cigarettes in life reserved 7, 9 (n=6, 19) — strip before any rule codebook · .xpt · R/02_build_analytic.R:68
Current smoking SMQ040 SMQ all six Do you now smoke cigarettes reserved 7 (n=3) — strip before any rule codebook · .xpt · R/02_build_analytic.R:68
Coronary heart disease MCQ160C MCQ all six Ever told you had coronary heart disease reserved 7, 9 (n=2, 136) — strip before any rule codebook · .xpt · R/02_build_analytic.R:71
Heart failure MCQ160B MCQ all six Ever told had congestive heart failure reserved 7, 9 (n=1, 94) — strip before any rule codebook · .xpt · R/02_build_analytic.R:71
Stroke MCQ160F MCQ all six Ever told you had a stroke reserved 7, 9 (n=1, 49) — strip before any rule codebook · .xpt · R/02_build_analytic.R:71
Cancer MCQ220 MCQ all six Ever told you had cancer or malignancy reserved 7, 9 (n=1, 29) — strip before any rule codebook · .xpt · R/02_build_analytic.R:72
Weak/failing kidneys KIQ022 KIQ_U all six Ever told you had weak/failing kidneys reserved 7, 9 (n=1, 53) — strip before any rule codebook · .xpt · R/02_build_analytic.R:73
Serum creatinine LBXSCR BIOPRO all six Creatinine (mg/dL) NA only codebook · .xpt · R/00_setup.R:53
Urine albumin URXUMA ALB_CR all six Albumin, urine (ug/mL) NA only — 7, 9, 77, 99 are real values (n=302, 254, 4, 11): do not strip codebook · .xpt · R/02_build_analytic.R:74
Urine creatinine URXUCR ALB_CR all six Creatinine, urine (mg/dL) NA only — 7, 9, 77, 99 are real values (n=22, 50, 252, 228): do not strip codebook · .xpt · R/02_build_analytic.R:74
Albumin-creatinine ratio URDACT ALB_CR FGHIJ only First albumin creatinine ratio (mg/g) NA only — 7, 9 are real values (n=44, 31): do not strip codebook · .xpt · R/02_build_analytic.R:74
Sedentary minutes PAD680 PAQ all six Minutes sedentary activity reserved 7777, 9999 (n=5, 187) — strip before any rule, but 7, 9 are real values (n=7, 1): do not strip codebook · .xpt · R/02_build_analytic.R:75
Total cholesterol LBXTC TCHOL all six Total Cholesterol (mg/dL) NA only — 77, 99 are real values (n=1, 23): do not strip codebook · .xpt · R/00_setup.R:57
LDL cholesterol LBDLDL TRIGLY all six LDL-cholesterol (mg/dL) NA only — 9, 77, 99 are real values (n=1, 142, 197): do not strip codebook · .xpt · R/02_build_analytic.R:61

Not every variable exists in every cycle

Verified against the files, not assumed. bind_rows() will happily fill an absent column with NA for a third of your sample, and that is a changing instrument, not Which cycle’s codebook are you reading?** For these variables that is not a rhetorical question, so every applicable cycle is linked separately.

Variable Component Present in Absent in Codebook, by cycle
DIQ070 DIQ FGHIJ E F · G · H · I · J
RIDRETH3 DEMO GHIJ EF G · H · I · J
ALQ120Q ALQ EFGHI J E · F · G · H · I
ALQ120U ALQ EFGHI J E · F · G · H · I
ALQ121 ALQ J EFGHI J
URDACT ALB_CR FGHIJ E F · G · H · I · J
ALQ130 ALQ all six none — but the instrument around it changed in J E · F · G · H · I · J

Reserved codes are not a property of NHANES. They are a property of the variable.

The single most dangerous piece of half-learned NHANES advice is “strip 777 and 999”. Applied to a laboratory variable it deletes real measurements. Below, every sentinel-looking value this reproduction’s variables actually contain, classified by whether it sits outside the variable’s own legitimate range.

Variable Reserved codes Sentinel-looking values that are real Largest legitimate value
RIDAGEYR none 7, 9, 77 (n=1282, 1258, 300) 80
SDDSRVYR none 7, 9 (n=9756, 9971) 10
SDMVSTRA none 77, 99 (n=823, 682) 148
LBXTR none 77, 99 (n=152, 117) 4,233
LBXSGTSI none 7, 9, 77, 99 (n=519, 1228, 27, 14) 1,510
BMXWAIST none 77, 99 (n=119, 132) 179
LBXGLU none 77, 99 (n=50, 709) 584
LBXGH none 7, 9 (n=173, 26) 17.8
DIQ010 7, 9 — 3
DIQ050 7, 9 — 2
DIQ070 7, 9 — 2
BPQ050A 9 — 2
BPQ100D 9 — 2
LBDHDD none 7, 77, 99 (n=1, 255, 32) 226
BMXHT none 99 (n=16) 204.5
RIDRETH3 none 7 (n=1996) 6
ALQ130 777, 999 7, 9 (n=197, 47) 83
ALQ120Q 777, 999 7, 9 (n=1146, 17) 365
ALQ121 77, 99 7, 9 (n=351, 476) 10
SMQ020 7, 9 — 2
SMQ040 7 — 3
MCQ160C 7, 9 — 2
MCQ160B 7, 9 — 2
MCQ160F 7, 9 — 2
MCQ220 7, 9 — 2
KIQ022 7, 9 — 2
URXUMA none 7, 9, 77, 99 (n=302, 254, 4, 11) 24,440
URXUCR none 7, 9, 77, 99 (n=22, 50, 252, 228) 800
URDACT none 7, 9 (n=44, 31) 92,500
PAD680 7777, 9999 7, 9 (n=7, 1) 1,380
LBXTC none 77, 99 (n=1, 23) 813
LBDLDL none 9, 77, 99 (n=1, 142, 197) 375

What this table does and does not license. For the variables used in this reproduction, the laboratory and examination measurements shown above use NA for missing, while several questionnaire variables use variable-specific reserved codes. Do not generalise either pattern to another variable — including another variable in the same component, or the same variable in another cycle. Check its codebook.

A 77 in LBXTR is a triglyceride of 77 mg/dL. A 77 in ALQ121 is a refusal. Same digits, opposite meaning. The point of this table is not a replacement rule to memorise; it is that there is no such rule, and the codebook decides.

The outcome does not live in NHANES

Concept Variable Source Notes
Vital status MORTSTAT NCHS Linked Mortality File separate fixed-width file, not an .xpt
Person-months from exam PERMTH_EXM NCHS Linked Mortality File the clock for time-to-event
Linkage eligibility ELIGSTAT NCHS Linked Mortality File not everyone is eligible for linkage

Downloaded by R/01_download.R from https://ftp.cdc.gov/pub/Health_Statistics/NCHS/datalinkage/linked_mortality. Follow-up ends 31 December 2019, per the NCHS 2019 linkage methodology document — not inferred from the filename.


Regenerate with Rscript R/07_variable_map.R. Codebook links use the current CDC path .../Public/<year>/DataFiles/<COMP>_<suffix>.htm#<VARIABLE>; the older wwwn.cdc.gov/Nchs/Nhanes/<cycle>/ form no longer resolves.