Dataset Viewer
Auto-converted to Parquet Duplicate
DUPERSID
string
CONDIDX
string
EVNTIDX
string
CLNKIDX
string
EVENTYPE
float64
PANEL
float64
30004010
300040100019
300040100023
300040100019300040100023
1
10
30004010
300040100025
300040100030
300040100025300040100030
1
10
30004010
300040100025
300040100061
300040100025300040100061
8
10
30004027
300040270018
300040270023
300040270018300040270023
1
10
30004027
300040270018
300040270047
300040270018300040270047
8
10
30004027
300040270018
300040270061
300040270018300040270061
1
10
30004027
300040270018
300040270078
300040270018300040270078
1
10
30004027
300040270018
300040270085
300040270018300040270085
1
10
30004027
300040270018
300040270092
300040270018300040270092
8
10
30004027
300040270018
300040270129
300040270018300040270129
1
10
30004027
300040270024
300040270030
300040270024300040270030
8
10
30004027
300040270024
300040270105
300040270024300040270105
8
10
30004027
300040270030
300040270143
300040270030300040270143
3
10
30005015
300050150022
300050150028
300050150022300050150028
1
10
30005015
300050150022
300050150100
300050150022300050150100
8
10
30005015
300050150038
300050150066
300050150038300050150066
8
10
30005015
300050150044
300050150011
300050150044300050150011
1
10
30005015
300050150044
300050150080
300050150044300050150080
8
10
30005015
300050150044
300050150117
300050150044300050150117
1
10
30005015
300050150044
300050150124
300050150044300050150124
1
10
30005015
300050150044
300050150131
300050150044300050150131
1
10
30005015
300050150044
300050150148
300050150044300050150148
1
10
30005015
300050150044
300050150155
300050150044300050150155
1
10
30005015
300050150044
300050150162
300050150044300050150162
1
10
30005015
300050150044
300050150179
300050150044300050150179
1
10
30005015
300050150044
300050150193
300050150044300050150193
8
10
30005015
300050150044
300050150244
300050150044300050150244
8
10
30005015
300050150044
300050150302
300050150044300050150302
1
10
30005015
300050150044
300050150319
300050150044300050150319
1
10
30005015
300050150044
300050150357
300050150044300050150357
8
10
30005015
300050150044
300050150388
300050150044300050150388
8
10
30005015
300050150050
300050150035
300050150050300050150035
1
10
30005015
300050150066
300050150059
300050150066300050150059
8
10
30005015
300050150066
300050150117
300050150066300050150117
1
10
30005015
300050150066
300050150124
300050150066300050150124
1
10
30005015
300050150066
300050150131
300050150066300050150131
1
10
30005015
300050150066
300050150148
300050150066300050150148
1
10
30005015
300050150066
300050150155
300050150066300050150155
1
10
30005015
300050150066
300050150162
300050150066300050150162
1
10
30005015
300050150066
300050150179
300050150066300050150179
1
10
30005015
300050150066
300050150206
300050150066300050150206
8
10
30005015
300050150072
300050150073
300050150072300050150073
8
10
30005015
300050150072
300050150097
300050150072300050150097
8
10
30005015
300050150072
300050150237
300050150072300050150237
8
10
30005015
300050150072
300050150302
300050150072300050150302
1
10
30005015
300050150072
300050150319
300050150072300050150319
1
10
30005015
300050150072
300050150340
300050150072300050150340
8
10
30005015
300050150072
300050150371
300050150072300050150371
8
10
30005015
300050150088
300050150117
300050150088300050150117
1
10
30005015
300050150088
300050150124
300050150088300050150124
1
10
30005015
300050150088
300050150131
300050150088300050150131
1
10
30005015
300050150088
300050150148
300050150088300050150148
1
10
30005015
300050150088
300050150155
300050150088300050150155
1
10
30005015
300050150088
300050150162
300050150088300050150162
1
10
30005015
300050150088
300050150179
300050150088300050150179
1
10
30005015
300050150088
300050150302
300050150088300050150302
1
10
30005015
300050150088
300050150319
300050150088300050150319
1
10
30005015
300050150094
300050150213
300050150094300050150213
8
10
30005015
300050150094
300050150302
300050150094300050150302
1
10
30005015
300050150094
300050150319
300050150094300050150319
1
10
30005015
300050150094
300050150364
300050150094300050150364
8
10
30005015
300050150107
300050150251
300050150107300050150251
8
10
30005015
300050150107
300050150302
300050150107300050150302
1
10
30005015
300050150107
300050150319
300050150107300050150319
1
10
30005015
300050150107
300050150395
300050150107300050150395
8
10
30005015
300050150113
300050150268
300050150113300050150268
8
10
30005015
300050150113
300050150333
300050150113300050150333
8
10
30005015
300050150135
300050150275
300050150135300050150275
1
10
30005015
300050150135
300050150282
300050150135300050150282
1
10
30005015
300050150135
300050150299
300050150135300050150299
1
10
30006012
300060120014
300060120067
300060120014300060120067
1
10
30006012
300060120014
300060120118
300060120014300060120118
8
10
30006012
300060120020
300060120101
300060120020300060120101
8
10
30006012
300060120036
300060120125
300060120036300060120125
8
10
30006012
300060120036
300060120194
300060120036300060120194
8
10
30006012
300060120042
300060120156
300060120042300060120156
1
10
30006012
300060120042
300060120163
300060120042300060120163
1
10
30006012
300060120042
300060120170
300060120042300060120170
1
10
30006029
300060290029
300060290012
300060290029300060290012
1
10
30006029
300060290029
300060290029
300060290029300060290029
1
10
30006029
300060290029
300060290036
300060290029300060290036
1
10
30006029
300060290029
300060290043
300060290029300060290043
1
10
30006029
300060290029
300060290074
300060290029300060290074
8
10
30006029
300060290035
300060290067
300060290035300060290067
8
10
30006029
300060290041
300060290081
300060290041300060290081
1
10
30006029
300060290041
300060290098
300060290041300060290098
1
10
30006029
300060290041
300060290101
300060290041300060290101
1
10
30006029
300060290041
300060290118
300060290041300060290118
1
10
30006029
300060290041
300060290132
300060290041300060290132
8
10
30006029
300060290041
300060290149
300060290041300060290149
8
10
30006029
300060290041
300060290156
300060290041300060290156
8
10
30006029
300060290041
300060290163
300060290041300060290163
2
10
30006029
300060290041
300060290170
300060290041300060290170
8
10
30006029
300060290041
300060290187
300060290041300060290187
8
10
30006029
300060290041
300060290194
300060290041300060290194
8
10
30006036
300060360028
300060360029
300060360028300060360029
1
10
30006036
300060360028
300060360036
300060360028300060360036
1
10
30006036
300060360028
300060360043
300060360028300060360043
1
10
30006036
300060360028
300060360050
300060360028300060360050
8
10
30006036
300060360028
300060360067
300060360028300060360067
8
10
End of preview. Expand in Data Studio

MEPS Household Component 1996–2024 in Parquet (with dictionaries and survey design)

This dataset contains the public use files (PUFs) of the Medical Expenditure Panel Survey Household Component (MEPS-HC) of the U.S. Agency for Healthcare Research and Quality (AHRQ), from data year 1996 through 2024. Each AHRQ data file was converted from SAS transport format to Parquet, one Parquet file per original AHRQ file, under the original HC number and file name. It also includes:

  • a variable dictionary for each data year (or multi-year period), built from the official AHRQ codebooks, with labels, formats, ASCII column positions and every published value code with its unweighted and weighted frequency;
  • a file catalogue with rows, grain and join keys of every file;
  • a year table with the person weight, variance stratum and PSU variables of every year and AHRQ's guidance for pooling years.

Built for the Bioanalysis R package. It works equally well with any tool that reads Parquet: DuckDB, Arrow, Polars, pandas or R.

Data years 1996–2024 (29 full-year consolidated files)
PUFs 448 HC public use files (HC-001 … HC-257), 517 Parquet data files in 9 categories
Rows 40,793,300 across all data files
Persons 897,782 person-year records in the full-year consolidated files; 483,346 records in the pooled linkage file HC-036
Values Original public-use codes; nothing recoded, imputed or dropped

Layout

data/<period>/<PUF>/<file>.parquet            e.g. data/2021/HC-233/h233.parquet
data/<period>/Dictionary/VARIABLES.parquet    one row per file x variable
data/<period>/Dictionary/VALUES.parquet       one row per file x variable x code
metadata/FILES.parquet                        every file: PUF, title, rows, grain, join keys, URLs, MD5
metadata/YEARS.parquet                        every year: FYC file, persons, panels, weights, strata, PSU
pipeline/                                     the R scripts, file catalogue and validation results
  • <period> is the data year (1996 … 2024) or, for multi-year files, first-last (2022-2023 for the Panel 27 longitudinal file, 1996-2024 for the pooled variance file, 2000-2013 for the employment variables file, …).
  • <PUF> is AHRQ's HC number and <file> the AHRQ data file name; Data by category below explains the naming and lists every file type.
  • PUFs that AHRQ split into several files keep each one: e.g. the 1996–1997 event files (h10bf1, h10bf2), the appendix files (h229if1 condition–event link, h229if2 prescribed-medicine link) and the Multum Lexicon addenda (HC-068, one file per year 1996–2013, placed under its year). The 1997–2000 Person Round Plan files (HC-047) are also placed under their years.
  • Superseded PUFs (AHRQ "replaced by", e.g. HC-228 → HC-233) are not included; the replacement contains all their variables.

Data by category

Files are grouped as AHRQ groups them: by data type (full-year consolidated, event files by type of event, conditions, linkage, jobs, …). A file type is the same kind of file released every year under a new HC number. The column category and file_type of metadata/FILES.parquet give both for every file.

Naming. AHRQ numbers each release HC-<number> (the folder) and names its data file h<number> (the Parquet file name): for example the full-year consolidated file is HC-012/h12 for 1996 and HC-256/h256 for 2024. Event files of a year share one number with a letter (A prescribed medicines … H home health, I appendix/link files); files that AHRQ split into parts end in f1, f2, … . Most variable names end in the 2-digit data year (TOTEXP21, PERWT21F) or the interview rounds they cover (AGE31X = round 3/1, …42, …53).

Category Contents File types Files Years
Full-Year Consolidated One row per person and year: demographics, income, health status, access to care, insurance, use and expenditure totals by type of care and source of payment, and the person, family and SAQ weights with the variance strata and PSUs. 1 29 1996–2024
Event files One row per medical event: prescribed medicine purchases, dental, other medical, inpatient, emergency room, outpatient, office-based and home health events, with dates, provider, condition codes and payments by source. 8 253 1996–2024
Medical conditions One row per medical condition reported for a person, with ICD and CCSR/CCS codes. 1 29 1996–2024
Linkage files Links between files: condition to event (CLNK), prescription to event (RXLK), and the pooled variance strata/PSUs (HC-036) and BRR replicates (HC-036BRR) for pooling years. 4 56 1996–2024
Jobs and employment One row per job held during the year (jobs files), and the 2000–2013 employment variables file. 2 30 1996–2024, 2000–2013
Person Round Plan Private health insurance plans held by each person in each interview round. 1 28 1996–2023
Point-in-time Person characteristics at one interview round (released before the full-year files). 1 24 1996–2019
Longitudinal panel files Two-, three- and four-year files following one panel, with the longitudinal weight LONGWT. 3 32 1996–1997 … 2023–2024 (32 periods)
Supplements and special topics One-off and topical files: supplemental PUFs 1996–2000, food security, preventive care SAQ, medical organizations survey, long-term care, health insurance plan abstraction, risk adjustment scores and the Multum Lexicon drug addenda. 8 36 1996–2014, 2016–2017, 2020–2022, 1996–2004, 2002–2009

Expand a category to see every file type: the official AHRQ title of its most recent release, the years it exists for, the HC numbers and file names (oldest … most recent), and its grain and join key. Path: data/<period>/<HC number>/<file>.parquet.

Full-Year Consolidated: 1 file type, 29 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
FYC Full Year Consolidated Data File 2024 Full Year Consolidated Data File 1996–2024 29 HC-012 h12 … HC-256 h256 one row per DUPERSID (key DUPERSID)
Event files: 8 file types, 253 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
RX Prescribed Medicines 2024 Prescribed Medicines File 1996–2024 29 HC-010A h10a … HC-254A h254a several rows per DUPERSID (key RXRECIDX)
DV Dental Visits 2024 Dental Visits File 1996–2024 32 HC-010B h10bf1 … HC-254B h254b several rows per DUPERSID (key EVNTIDX)
OM Other Medical Expenses 2024 Other Medical Expenses File 1996–2024 32 HC-010C h10cf1 … HC-254C h254c several rows per DUPERSID (key EVNTIDX)
IP Hospital Inpatient Stays 2024 Hospital Inpatient Stays File 1996–2024 32 HC-010D h10df1 … HC-254D h254d several rows per DUPERSID (key EVNTIDX)
ER Emergency Room Visits 2024 Emergency Room Visits File 1996–2024 32 HC-010E h10ef1 … HC-254E h254e several rows per DUPERSID (key EVNTIDX)
OP Outpatient Visits 2024 Outpatient Visits File 1996–2024 32 HC-010F h10ff1 … HC-254F h254f several rows per DUPERSID (key EVNTIDX)
OB Office-Based Medical Provider Visits 2024 Office-Based Medical Provider Visits File 1996–2024 32 HC-010G h10gf1 … HC-254G h254g several rows per DUPERSID (key EVNTIDX)
HH Home Health 2024 Home Health File 1996–2024 32 HC-010H h10hf1 … HC-254H h254h several rows per DUPERSID (key EVNTIDX)
Medical conditions: 1 file type, 29 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
COND Medical Conditions 2024 Medical Conditions File 1996–2024 29 HC-006R h06r … HC-255 h255 several rows per DUPERSID (key CONDIDX)
Linkage files: 4 file types, 56 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
CLNK Condition-event link Appendix to MEPS 2024 Event Files: condition-event link file (CLNK) 1996–2024 29 HC-010I h10if1 … HC-254I h254i several rows per DUPERSID (key CLNKIDX)
RXLK Prescribed medicines-event link Appendix to MEPS 2020 Event Files: prescribed medicines-event link file (RXLK) 1996–2020 25 HC-010I h10if2 … HC-220I h220if2 several rows per DUPERSID (key RXLKIDX)
POOL Pooled linkage file for common variance structure 1996-2024 Pooled Linkage File for Common Variance Structure 1996–2024 1 HC-036 h36u24 one row per DUPERSID + PANEL (key DUPERSID + PANEL)
BRR BRR replicate file MEPS 1996-2024 Replicate File for BRR Variance Estimation 1996–2024 1 HC-036BRR h36brr24 one row per DUPERSID + PANEL (key DUPERSID + PANEL)
Jobs and employment: 2 file types, 30 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
JOBS Jobs 2024 Jobs File 1996–2024 29 HC-007 h07 … HC-253 h253 several rows per DUPERSID (key JOBSIDX)
EMPL Employment variables 2000-2013 Employment Variables File 2000–2013 1 HC-131 h131 several rows per DUPERSID (key no unique key among the standard IDs)
Person Round Plan: 1 file type, 28 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
PRPL Person Round Plan 2023 Person Round Plan File 1996–2023 28 HC-024 h24 … HC-250 h250 several rows per DUPERSID (key EPCPIDX)
Point-in-time: 1 file type, 24 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
PIT Population characteristics (point-in-time) 2019 P23R3/P24R1 Population Characteristics 1996–2019 24 HC-001 h01 … HC-205 h205 one row per DUPERSID (key DUPERSID)
Longitudinal panel files: 3 file types, 32 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
LONG2 Two-year longitudinal panel file MEPS Panel 28 Longitudinal Data File 1996–1997 … 2023–2024 (28 periods) 28 HC-023 h23 … HC-257 h257 one row per DUPERSID (key DUPERSID)
LONG3 Three-year longitudinal panel file MEPS Panel 24 Three-Year Longitudinal Data File 2018–2020, 2019–2021 2 HC-226 h226, HC-235 h235 one row per DUPERSID (key DUPERSID)
LONG4 Four-year longitudinal panel file MEPS Panel 24 Four-Year Longitudinal Data File 2018–2021, 2019–2022 2 HC-236 h236, HC-245 h245 one row per DUPERSID (key DUPERSID)
Supplements and special topics: 8 file types, 36 files
File type Most recent official title Years Files HC number / file (oldest … latest) Grain (join key)
FYC-Supp Supplemental public use file 1999 Supplemental Public Use File 1996–1999 7 HC-041 h41 … HC-044 h44 one row per DUPERSID (key DUPERSID); several rows per DUPERSID (key EVNTIDX); several rows per DUPERSID (key no unique key among the standard IDs)
FS Food security 2022 Food Security File 2016–2017, 2020–2022 5 HC-189 h189 … HC-240 h240 household / family level (DUID) (key HOMEIDX)
PSAQ Preventive care self-administered questionnaire 2014 Preventive Care Self-Administered Questionnaire File 2014 1 HC-173 h173 one row per DUPERSID (key DUPERSID)
MOS Medical organizations survey 2016 Full Year Medical Organizations Survey File 2016 1 HC-187 h187 one row per DUPERSID (key DUPERSID)
RX-Multum Multum Lexicon addendum (drug classes) Multum Lexicon Addendum Files to MEPS Prescribed Medicines Files 1996-2013: 2013 file (H68F18) 1996–2013 18 HC-068 h68f1 … HC-068 h68f18 several rows per DUPERSID (key RXRECIDX)
RISK Risk adjustment scores 2002-2009 Risk Adjustment Scores File 1996–2004, 2002–2009 2 HC-092 h92, HC-140 h140 one row per DUPERSID + PANEL (key DUPERSID + PANEL); one row per DUPERSID (key DUPERSID)
LTC Long term care 1998 Long Term Care 1998 1 HC-049 h49 one row per DUPERSID (key DUPERSID)
HIPA Health insurance plan abstraction linked data 1996 Health Insurance Plan Abstraction Linked Data 1996 1 HC-017 h17 several rows per DUPERSID (key no unique key among the standard IDs)

Hugging Face subsets and splits

On Hugging Face a subset (also called a config) is one named table: it is the drop-down list above the Dataset Viewer and the second argument of load_dataset("jamesjiadazhan/MEPS", "<subset>"). A split is a part of a subset, chosen with split=. In this dataset a split is either all (the whole table) or one data year (y2021 is 2021). The dictionary subsets hold every period in their all split: the column period (2021, or 2022-2023 for a multi-year file) tells the years apart. The condition–event link files carry no year column, so the year is the split name; add it as a column before stacking splits.

Subset What it holds Splits
files Catalogue of every data file: period, HC number, file, official title, category, file type, rows, columns, grain, join keys, path, source / documentation / codebook URLs, MD5. all (1 file)
years One row per data year: full-year consolidated file, persons, panels, person / family / SAQ weights, variance stratum and PSU variables, pooling guidance. all (1 file)
dictionary_variables Variable dictionary of every period: one row per file × variable. all (64 files)
dictionary_values Value dictionary of every period: one row per file × variable × code, with AHRQ's unweighted and weighted frequencies. all (64 files)
condition_event_link Condition–event link (CLNK) files: one row per condition × event (DUPERSID, CONDIDX, EVNTIDX, CLNKIDX, EVENTYPE, PANEL). 20, one per data year (y2005 … y2024)
pooled_variance_linkage HC-036: pooled variance strata and PSUs (STRA9624, PSU9624) for every person 1996–2024, by DUPERSID + PANEL. all (1 file)
pooled_variance_brr HC-036BRR: the 128 BRR replicate indicators for pooled variance estimation, by DUPERSID + PANEL. all (1 file)

The other 495 data files are not subsets. A subset needs the same columns in every file, and MEPS files change columns every year: variable names carry the data year (TOTEXP20 → TOTEXP21) and AHRQ adds and drops variables. The full-year consolidated files also have 1,215–2,052 columns, and 61 files have more than 1,000 columns, beyond what the Dataset Viewer shows. Read these files by path (see Quick start), for example data/2024/HC-254D/h254d.parquet (2024 Hospital Inpatient Stays File). The files subset lists every path; the Files and versions tab shows every file.

Data dictionary

Each period (data year, or multi-year period such as 2022-2023) has its own dictionary, built from the AHRQ codebook of every file:

File Subset One row per Main columns
data/<period>/Dictionary/VARIABLES.parquet dictionary_variables file × variable file, file_title, variable, label (codebook description, else SAS label), type, start/end (columns in AHRQ's ASCII file), codebook_format, codebook_weight (weight used for the published weighted frequencies), n_nonmissing, in_codebook, dictionary_source, codebook_url, doc_url
data/<period>/Dictionary/VALUES.parquet dictionary_values file × variable × code code_or_value (a code, or a range such as 0 - 85 or $1 - $613), value_description, count (unweighted), weighted_count, weight, source

Coverage. 179,745 file × variable rows over 517 files; 178,841 (99.5%) are matched to an AHRQ codebook entry, and 894,311 value rows. Label source (dictionary_source): AHRQ HTML codebook (2,698); AHRQ PDF codebook (176,143); AHRQ SAS programming statements (10); data file label (894). Files with no AHRQ codebook (labels from the SAS statements and the file): h10if1, h10if2, h118a, h32, h34. MEPS codebooks publish no question text or universe per variable: see the MEPS-HC questionnaires and each file's documentation (doc_url). AHRQ's reserved codes are kept as released (-1 inapplicable, -7 refused, -8 don't know, -9 not ascertained, -15 cannot be computed, …).

Lookup. Filter on file and variable, e.g. file = 'h233', variable = 'RACETHX' in data/2021/Dictionary/VALUES.parquet gives 5 codes (Quick start has the query). The official codebook (PDF, or AHRQ's HTML codebook) and documentation of every file are linked in codebook_url and doc_url, in the dictionary and in the files subset.

Joining

Use metadata/FILES.parquet (grain, join_keys, person_key) for every file.

  • Persons. DUPERSID identifies a person within a panel. Join person-level files of the same year on DUPERSID; across years and in pooled files use DUPERSID + PANEL (the panel variable is PANEL from 2005 on, PANELyy before, and missing in 1996 where AHRQ says to set PANEL = 1).
  • DUPERSID format changed in 2018. Up to 2017 DUPERSID = DUID (5) + PID (3), 8 characters; from 2018 it is 10 characters with the panel number in front. Panel 22 persons therefore have one DUPERSID in 2017 and a different one in 2018 (HC-036 lists them twice). Do not link 2017 and 2018 records by DUPERSID alone.
  • Events. EVNTIDX is unique within a year across all event files. Prescribed medicine acquisitions (RXRECIDX) link to the event they were prescribed at through LINKIDX (= EVNTIDX), via the appendix Rx link file.
  • Conditions ↔ events. Use the appendix condition–event link file (CLNK, …if1): CONDIDX (Medical Conditions file) + EVNTIDX (event files).
  • Panels across years. The two-year longitudinal panel files (Panel N Longitudinal Data File) and the 3- and 4-year Panel 23/24 files already combine the years of one panel with the longitudinal weight (LONGWT).
  • Identifiers are only meaningful within MEPS; the AHRQ data use agreement forbids linking to other individually identifiable data (see below).

Quick start

DuckDB (Python, R or CLI). No download is needed:

import duckdb
con = duckdb.connect()
base = "hf://datasets/jamesjiadazhan/MEPS/data"
con.sql(f"""
    SELECT DUPERSID, PANEL, AGE21X, SEX, TOTEXP21, PERWT21F, VARSTR, VARPSU
    FROM read_parquet('{base}/2021/HC-233/h233.parquet')
""").df()

Conditions linked to office-based visits, 2021:

con.sql(f"""
    SELECT c.DUPERSID, c.ICD10CDX, o.EVNTIDX, o.OBXP21X
    FROM read_parquet('{base}/2021/HC-231/h231.parquet') c
    JOIN read_parquet('{base}/2021/HC-229I/h229if1.parquet') l USING (CONDIDX)
    JOIN read_parquet('{base}/2021/HC-229G/h229g.parquet') o ON o.EVNTIDX = l.EVNTIDX
""").df()

Dictionary lookup:

con.sql(f"""
    SELECT file, variable, label, codebook_weight FROM read_parquet('{base}/2021/Dictionary/VARIABLES.parquet')
    WHERE lower(label) LIKE '%diabetes%'
""").show()
con.sql(f"""
    SELECT code_or_value, value_description, count, weighted_count
    FROM read_parquet('{base}/2021/Dictionary/VALUES.parquet')
    WHERE file = 'h233' AND variable = 'RACETHX'
""").show()

R (arrow):

library(arrow)
base <- "https://huggingface.co/datasets/jamesjiadazhan/MEPS/resolve/main/data"
fyc <- read_parquet(file.path(base, "2021/HC-233/h233.parquet"))

Hugging Face datasets (see Hugging Face subsets and splits for every subset):

from datasets import load_dataset
v = load_dataset("jamesjiadazhan/MEPS", "dictionary_variables", split="all")
v = v.filter(lambda r: r["period"] == "2021")

Survey design: required for every MEPS estimate

MEPS-HC is a complex, multistage probability sample (a subsample of the previous year's NHIS households, with overlapping two-year panels). Every estimate, including descriptive statistics and regression, must use the weights and the variance strata and PSUs.

  • Weights (per year in metadata/YEARS.parquet):
    • persons: PERWTyyF (1999+; WTDPERyy in 1996–1998), e.g. PERWT21F;
    • families: FAMWTyyF; SAQ (adult self-administered questionnaire): SAQWTyyF; diabetes care survey DIABWyyF; 2-, 3- and 4-year panel files: LONGWT;
    • event, condition and prescription files carry the person weight PERWTyyF of the person.
  • Strata and PSUs: VARSTR and VARPSU (2002 onward); VARSTRyy / VARPSUyy in 1996–2001. In R: survey::svydesign(ids = ~VARPSU, strata = ~VARSTR, weights = ~PERWT21F, nest = TRUE, data = fyc). AHRQ's own code uses options(survey.lonely.psu = "adjust").
  • Subpopulations: keep all respondents in the design and use subset() / domain estimation; do not drop records first (HC-036 documentation, section 5.0).
  • Pooling years (HC-036 documentation):
    • stack the annual files (make variable names consistent: most carry a 2-digit year suffix);
    • years 2002–2018 share one variance structure, and 2019 onward share another; pooling within one of those ranges can use the annual VARSTR/VARPSU;
    • when any pooled year is 1996–2001, or 2019+ years are pooled with earlier years, merge STRA9624 and PSU9624 from HC-036 (data/1996-2024/HC-036/h36u24.parquet) by DUPERSID + PANEL and use those instead; the BRR replicate weights are in HC-036BRR;
    • divide the weights by the number of pooled years for average-annual estimates (keep them unchanged for a total over the whole period).
  • Persons with a zero person weight (e.g. not in scope for the whole year) are kept as AHRQ released them; they contribute nothing to weighted estimates.

Validation

All checks are in pipeline/05_validate.R; results in pipeline/validation.csv (one row per check).

  • Published estimates with standard errors. For every year 1996–2018 (the years in AHRQ's public MEPS-HC summary tables), five person-level estimates were recomputed from the Parquet FYC files with survey::svydesign(ids = ~VARPSU, strata = ~VARSTR, weights = ~PERWTyyF, nest = TRUE) (AHRQ's own specification): population, percent with an expense, mean expenditure per person, mean per person with an expense, and total expenditure. 115 of 115 estimates and standard errors match AHRQ's published values at the published precision (e.g. 2018: 326,328 thousand persons, SE 7,296; mean expenditure per person $6,063, SE 128.0).
  • Text encoding. A few drug names (1998–2002 RXNAME/RXFORM) and labels were stored by AHRQ in Windows-1252; they are transcoded to the same characters in UTF-8.
  • Row counts. 506 of 509 files match the unweighted total printed in their AHRQ codebook. The three exceptions are 1996–1997 event f2 files (h10gf2, h16cf2, h16hf2) that hold fewer events than f1; their shared HTML codebook prints the f1 total.
  • Two-member transport file. AHRQ's h10bf2ssp.zip holds two data sets: a copy of HC10BF1 followed by HC10BF2. Only the HC10BF2 member (22,165 rows × 20 columns) is converted to h10bf2; it matches the codebook total and links to h10bf1 on EVNTIDX.
  • Pooled and full-year totals. The pooled variance file HC-036 has 483,346 records and the 29 FYC files 897,782 records in total, exactly as stated in the HC-036 documentation. 275 files also match a record count quoted in their documentation text (the others quote no count that refers to the file).
  • Codebook frequencies. Every value with a single numeric code in the codebooks was recounted from the Parquet files: 642,030 of 642,800 unweighted counts (99.88%) and 473,161 of 473,379 weighted counts (99.95%) match. The remaining differences come from codebook text that pdftotext cannot split unambiguously (e.g. code and identical description run together) and from the shared f1/f2 codebooks, not from the data.

Sources and processing

Part Source Processing
Data files MEPS download data files (search_pufs.json catalogue and each PUF's detail page) SAS transport (<file>ssp.zip) read with haven::read_xpt; HC-001 (ASCII only) read with the INPUT layout of AHRQ's SAS statements; labels/formats moved to the dictionary; values unchanged; zstd Parquet
Dictionaries AHRQ PDF codebooks, HTML codebooks, SAS programming statements pdftotext -layout and parsing (see pipeline/codebook_parse.R)
Year table FYC files and HC-036 documentation weights / strata / PSU names detected from the FYC columns
Validation estimates HHS-AHRQ/MEPS-summary-tables formatted_tables/hc_use recomputed with survey

Coverage. Every non-superseded Household Component PUF listed by AHRQ (HC-001 onward, all data years; counts in the table at the top), in its latest release at the time of the build. Not included: the MEPS Insurance Component, the Nursing Home Component (NHC-*), the HC/IC and MEPS–NHIS link files (not HC PUFs), NHEA-aligned projections, and restricted-use data (AHRQ Data Center). Other AHRQ formats of the same data (ASCII, SAS V9, Stata, Excel) are not mirrored.

Licence, data use agreement and citation

  • Public domain. AHRQ: "The Agency for Healthcare Research and Quality (AHRQ) is a federal government agency and everything published, both in hard copy and electronically, is in the public domain, except for previously copyrighted photographs and illustrations. This public domain material is free for use without specific permission, although it is requested that the user cite AHRQ and the Medical Expenditure Panel Survey as the source." (MEPS copyright notice)
  • Data use agreement (binding on every user of these data). Each MEPS PUF documentation (section A, e.g. HC-233) states: "Individual identifiers have been removed from the micro-data contained in these files. Nevertheless, under sections 308 (d) and 903 (c) of the Public Health Service Act (42 U.S.C. 242m and 42 U.S.C. 299 a-1), data collected by the Agency for Healthcare Research and Quality (AHRQ) and/or the National Center for Health Statistics (NCHS) may not be used for any purpose other than for the purpose for which they were supplied; any effort to determine the identity of any reported cases is prohibited by law." Users must agree that: no one is to use the data except for statistical reporting and analysis; if the identity of any person or establishment is discovered inadvertently, no use will be made of it, the Director, Office of Management, AHRQ will be advised, the information will be safeguarded or destroyed as AHRQ requests, and no one else will be informed; and no one will attempt to link the data with individually identifiable records from any data sets other than MEPS or NHIS (and MEPS–NHIS linkage only inside the AHRQ Data Center, NCHS RDC or Census RDC network). "By using these data you signify your agreement to comply with the above stated statutorily based requirements."
  • Cite: Agency for Healthcare Research and Quality. Medical Expenditure Panel Survey Household Component public use files, 1996–2024. Rockville, MD: AHRQ. Cite each HC file you use (e.g. MEPS HC-233: 2021 Full Year Consolidated Data File).
  • This compilation (pipeline, dictionaries, layout) is released under CC0-1.0. It is not an AHRQ product and AHRQ has not reviewed it.
Downloads last month
122