SAS® Programming Examples from MEPS Data
Users Workshops
At MEPS data users workshops, MEPS staff demonstrate how to develop estimates
using the public use files and how to construct MEPS analytic files using SAS.
They
also
assist
attendees in the construction of estimates and analytic files for their own research.
Provided below are SAS programming
examples used in recent MEPS workshops. As with the workshops themselves,
to benefit from these examples you
should have a working knowledge of SAS. Each example is available in
both SAS and HTML file formats. The SAS file is the annotated program
that performs the
stated task; you will need SAS on your computer to view and use this
format. The HTML file provides both the annotated SAS program and the
resulting
output;
you do not need to have SAS on your computer to view these files.
Estimation Examples |
SAS® |
HTML |
Compute
person-level estimates for healthcare expenditures. Estimates include:
Means, Proportions, Totals. |
E1.sas (4.1 KB) |
E1.html |
Compute average
total healthcare expenditures for children ages 0-5 for the 4 years
1996 – 1999. |
E2.sas (5.9 KB) |
E2.html |
Create a longitudinal file for 1999-2000
(Panel 4) and compute person-level estimates for insurance coverage
and expenditures. |
E3.sas (3.5 KB) |
E3.html |
Compute family-level estimates for
healthcare expenditures based on family size. |
E4.sas (3.4 KB) |
E4.html |
Compute event-level expenditure estimates
for inpatient hospital stay events and for office-based medical provider
visits. |
E5.sas (2.2 KB) |
E5.html |
Employment Examples |
SAS® |
HTML |
Build
an analytic file to look at the relationship between health status
and current main job weekly earnings. |
EM1.sas (4.9 KB) |
EM1.html |
Determine how many people working at
the beginning of 2002 changed jobs. |
EM2.sas (3.5 KB) |
EM2.html |
Linking Examples |
SAS® |
HTML |
Merge the
2001 MEPS full-year file and the 2001 MEPS Jobs file to count the
number of jobs for each person in the first part of 2001. |
L1.sas (4.0 KB) |
L1.html |
Combine the
2000 and 2001 MEPS Jobs files to identify 2001 jobs first reported
in 2000 and update 2001 file information for those jobs. |
L1A.sas (3.7 KB) |
L1A.html |
Use the NHIS-MEPS
Link File to link 2001 MEPS data with 1999 and 2000 NHIS data. |
L2.sas (4.7 KB) |
L2.html |
Merge data from
the 2001 MEPS Office-based Medical Provider Visits file with data
from the 2001 MEPS full-year file. Aggregate event-level data to
the person level. |
L3.sas (3.7 KB) |
L3.html |
Merge data
from the 2001 MEPS Medical Conditions file with data from the 2001
MEPS full-year file. |
L4.sas (3.5 KB) |
L4.html |
Merge data from the 2001 MEPS Medical
Conditions file with data from the 2001 MEPS full-year file and with
data from various 2001 MEPS event files (prescribed medicines, emergency
room visits, outpatient visits, and office-based medical provider
visits). |
L5.sas (6.0 KB) |
L5.html |
Miscellaneous Examples |
SAS® |
HTML |
Shows the need for using weight variables when analyzing MEPS
data for national estimates. |
M1.sas (1.6 KB) |
M1.html |
Shows the
need for using the STRATUM and PSU variables when analyzing MEPS
data for national estimates.
That is, taking the MEPS complex design properties into account. |
M2.sas (1.5 KB) |
M2.html |
Shows the use of id variables on different MEPS public-use
files (pufs) and how to use these id variables to merge MEPS files. |
M3.sas (2.8 KB) |
M3.html |
Illustrates two ways of
determining the number of events associated with conditions.
(1) using the evNUM variables on the CONDITIONS file.
(2) using the number of matches between the CONDITIONS file and the CLINK file. |
M4.sas (3.4 KB) |
M4.html |
Shows the difference
between two uses of the term "priority condition" in MEPS. |
M5.sas (5.7 KB) |
M5.html |
Shows the use
of the Diabetes Care Supplement (DCS) weight variable, diabw03f) for
generating estimates for analyses using questions from the DCS. |
M6.sas (1.7 KB) |
M6.html |
Shows how to compute person-level prescribed
medicine expenditures for persons with at least one PMED event. |
M7.sas (3.3 KB) |
M7.html |
Shows how to compute
prescribed medicine expenditures associated with cancer conditions. |
M8.sas (5.7 KB) |
M8.html |
Uses the 2003 full-year file to output descriptive
statistics showing health insurance status and healthcare utilization. |
M9.sas (2.0 KB) |
M9.html |
Compares hospital inpatient
expenditures (facility, physician, total) for stays that do and do not
include facility expenditures for the preceding emergency room visit. |
M10.sas (2.5 KB) |
M10.html |
Public use files used in the SAS® programming
examples
PUF
no. |
Data
year |
File
name |
Examples
|
H12
|
1996 |
Full-Year
Consolidated Data |
E2 |
H20 |
1997 |
Full-Year
Consolidated Data |
E2 |
H28 |
1998 |
Full-Year
Consolidated Data |
E2 |
H38 |
1999 |
Full-Year
Consolidated Data |
E2, E3 |
H40 |
2000 |
Jobs File |
L1A |
H50 |
2000 |
Full-Year
Consolidated Data |
E3 |
H56 |
2001 |
Jobs File |
L1, L1A |
H59a |
2001 |
Prescribed Medicines |
L5 |
H59d |
2001 |
Hospital Inpatient
Stays |
E5 |
H59e |
2001 |
Emergency Room Visits |
L5 |
H59f |
2001 |
Outpatient Visits |
L5 |
H59g |
2001 |
Office-Based Provider
Visits |
E5, L3, L5 |
H59i |
2001 |
CLNK File |
L5 |
H60 |
2001 |
Full-Year
Consolidated Data |
E1, E4, L1, L2, L3,
L4, L5 |
H61 |
2001 |
Medical Conditions |
L4, L5 |
H62 |
2002 |
Full-Year
Population Characteristics |
EM1, EM2 |
H63 |
2002 |
Jobs File |
EM2 |
H36 |
1996–2002 |
1996–2002
Pooled Estimation File |
E2 |
H58 |
1999–2000 |
Panel 4 Longitudinal
Weight File |
E3 |
H77A |
2003 |
Prescribed Medicines File |
M7, M8 |
H77D |
2003 |
Hospital Inpatient Stays |
M10 |
H77IF1 |
2003 |
Condition - Event Link Files (CLINK) |
M4, M8 |
H78 |
2003 |
Medical Conditions File |
M3, M4, M5, M8 |
H79 |
2003 |
Full Year Consolidated Data File |
M1, M2, M3, M5, M6, M7, M8, M9 |
NHIS |
NHISPER99.DAT |
1999 |
NHIS Person File |
L2 |
NHISPER00.DAT |
2000 |
NHIS Person File |
L2 |
NHMEP01X.DAT |
1999–2000 |
NHIS–MEPS
Link File |
L2 |
Notes:
The SAS programs contain LIBNAME statements which specify the directory location
of the input data. For these examples the directory is "C:\MEPS\DATA".
You will need to specify the directory information that corresponds to your
own system.
The LIBNAME statement also creates a name by which the directory location is
referred to in the remainder of the program. For these examples the name is "CMEPS".
In the program examples you will see particular data files referred to by "CMEPS.filename" where
filename is the name for a particular data file.
The MEPS public use data files used in these examples are from the MEPS Household
Component (HC) and are referred to by an initial "H" or "HC-" and
then the number assigned to the particular file. The first column in the table
above gives the names of the files used in the programs. As with the directory
specifications, filenames used in your programs will need to correspond to
the names of the files on your system.
All MEPS public use files and file documentation are available for
download.
|