/************************************************************************************************/ /* Stata User File for H213E Data */ /* */ /* This file contains information and a sample Stata program to create a permanent */ /* Stata dataset for users who want to use Stata in processing the MEPS data provided */ /* in this PUF release. Stata (StataCorp) has the capability to produce */ /* appropriate standard errors for estimates from a survey with a complex sample */ /* design such as the Medical Expenditure Panel Survey (MEPS). */ /* The input file for creating a permanent Stata dataset is the ASCII data file */ /* (H213E.DAT) supplied in this PUF release. */ /* After entering the Stata interactive environment access the Stata DO-File */ /* editor by clicking on the appropriate icon in the command line at the top of the */ /* screen. Copy and paste the following Stata commands into the editor and save as a */ /* DO file. A DO file is a Stata program which may then be executed using the DO command. */ /* For example, if the DO file is named H213E.DO and is located in the directory */ /* C:\MEPS\PROG, then the file may be executed by typing the following command into */ /* the Stata command line: */ /* do C:\MEPS\PROG\H213E.DO */ /* The program below will output the Stata dataset H213E.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H213E.log, replace; clear; * INPUT ALL VARIABLES; infix long DUID 1-7 int PID 8-10 str DUPERSID 11-20 str EVNTIDX 21-36 byte EVENTRN 37-37 str ERHEVIDX 38-53 str FFEEIDX 54-65 byte PANEL 66-67 byte MPCDATA 68-68 int ERDATEYR 69-72 byte ERDATEMM 73-74 byte VSTCTGRY 75-76 byte VSTRELCN 77-78 byte LABTEST_M18 79-80 byte SONOGRAM_M18 81-82 byte XRAYS_M18 83-84 byte MAMMOG_M18 85-86 byte MRI_M18 87-88 byte EKG_M18 89-90 byte RCVVAC_M18 91-92 byte SURGPROC 93-94 byte MEDPRESC 95-96 byte FFERTYPE 97-98 double ERXP19X 99-106 double ERTC19X 107-115 double ERFSF19X 116-122 double ERFMR19X 123-130 double ERFMD19X 131-138 double ERFPV19X 139-146 double ERFVA19X 147-154 double ERFTR19X 155-162 double ERFOF19X 163-169 double ERFSL19X 170-177 double ERFWC19X 178-184 double ERFOT19X 185-192 double ERFXP19X 193-200 double ERFTC19X 201-209 double ERDSF19X 210-216 double ERDMR19X 217-223 double ERDMD19X 224-230 double ERDPV19X 231-237 double ERDVA19X 238-244 double ERDTR19X 245-250 double ERDOF19X 251-254 double ERDSL19X 255-260 double ERDWC19X 261-267 double ERDOT19X 268-274 double ERDXP19X 275-281 double ERDTC19X 282-289 byte IMPFLAG 290-290 double PERWT19F 291-302 int VARSTR 303-306 byte VARPSU 307-307 using H213E.dat; *DEFINE VARIABLE LABELS; label variable DUID "PANEL # + ENCRYPTED DU IDENTIFIER"; label variable PID "PERSON NUMBER"; label variable DUPERSID "PERSON ID (DUID + PID)"; label variable EVNTIDX "EVENT ID"; label variable EVENTRN "EVENT ROUND NUMBER"; label variable ERHEVIDX "EVENT ID FOR CORRESPONDING HOSPITAL STAY"; label variable FFEEIDX "FLAT FEE ID"; label variable PANEL "PANEL NUMBER"; label variable MPCDATA "MPC DATA FLAG"; label variable ERDATEYR "EVENT DATE - YEAR"; label variable ERDATEMM "EVENT DATE - MONTH"; label variable VSTCTGRY "BEST CATEGORY FOR CARE P RECV ON VISIT DT"; label variable VSTRELCN "THIS VISIT RELATED TO SPEC CONDITION"; label variable LABTEST_M18 "THIS VISIT DID P HAVE LAB TESTS"; label variable SONOGRAM_M18 "THIS VISIT DID P HAVE SONOGRAM OR ULTRSD"; label variable XRAYS_M18 "THIS VISIT DID P HAVE X-RAYS"; label variable MAMMOG_M18 "THIS VISIT DID P HAVE A MAMMOGRAM"; label variable MRI_M18 "THIS VISIT DID P HAVE AN MRI/CATSCAN"; label variable EKG_M18 "THIS VISIT DID P HAVE AN EKG, EEG OR ECG"; label variable RCVVAC_M18 "THIS VISIT DID P RECEIVE A VACCINATION"; label variable SURGPROC "WAS SURG PROC PERFORMED ON P THIS VISIT"; label variable MEDPRESC "ANY MEDICINE PRESCRIBED FOR P THIS VISIT"; label variable FFERTYPE "FLAT FEE BUNDLE"; label variable ERXP19X "TOTAL EXP FOR EVENT (ERFXP19X + ERDXP19X)"; label variable ERTC19X "TOTAL CHG FOR EVENT (ERFTC19X + ERDTC19X)"; label variable ERFSF19X "FACILITY AMOUNT PAID, FAMILY (IMPUTED)"; label variable ERFMR19X "FACILITY AMOUNT PAID, MEDICARE (IMPUTED)"; label variable ERFMD19X "FACILITY AMOUNT PAID, MEDICAID (IMPUTED)"; label variable ERFPV19X "FACILITY AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable ERFVA19X "FACILITY AMOUNT PAID, VETERANS/CHAMPVA(IMPUTED)"; label variable ERFTR19X "FACILITY AMOUNT PAID, TRICARE(IMPUTED)"; label variable ERFOF19X "FACILITY AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable ERFSL19X "FACILITY AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable ERFWC19X "FACILITY AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable ERFOT19X "FACILITY AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable ERFXP19X "FACILITY SUM PAYMENTS ERFSF19X - ERFOT19X"; label variable ERFTC19X "TOTAL FACILITY CHARGE (IMPUTED)"; label variable ERDSF19X "DOCTOR AMOUNT PAID, FAMILY (IMPUTED)"; label variable ERDMR19X "DOCTOR AMOUNT PAID, MEDICARE (IMPUTED)"; label variable ERDMD19X "DOCTOR AMOUNT PAID, MEDICAID (IMPUTED)"; label variable ERDPV19X "DOCTOR AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable ERDVA19X "DOCTOR AMOUNT PAID, VETERANS/CHAMPVA(IMPUTED)"; label variable ERDTR19X "DOCTOR AMOUNT PAID, TRICARE(IMPUTED)"; label variable ERDOF19X "DOCTOR AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable ERDSL19X "DOCTOR AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable ERDWC19X "DOCTOR AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable ERDOT19X "DOCTOR AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable ERDXP19X "DOCTOR SUM PAYMENTS ERDSF19X - ERDOT19X"; label variable ERDTC19X "TOTAL DOCTOR CHARGE (IMPUTED)"; label variable IMPFLAG "IMPUTATION STATUS"; label variable PERWT19F "EXPENDITURE FILE PERSON WEIGHT, 2019"; label variable VARSTR "VARIANCE ESTIMATION STRATUM, 2019"; label variable VARPSU "VARIANCE ESTIMATION PSU, 2019"; *DEFINE VALUE LABELS FOR REPORTS; label define H213E0001X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H213E0002X -7 "-7 REFUSED" -8 "-8 DK" ; label define H213E0003X -7 "-7 REFUSED" -8 "-8 DK" 2019 "2019" ; label define H213E0004X 1 "ROUND 1" 2 "ROUND 2" 3 "ROUND 3" 4 "ROUND 4" 5 "ROUND 5" ; label define H213E0005X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 FLAT FEE STEM" 2 "2 FLAT FEE LEAF" ; label define H213E0006X 0 "0 NOT ELIGIBLE FOR IMPUTATION" 1 "1 COMPLETE HC DATA" 2 "2 COMPLETE MPC DATA" 3 "3 FULLY IMPUTED" 4 "4 PARTIALLY IMPUTED" 5 "5 CAPITATION IMPUTATION" ; label define H213E0007X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H213E0008X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H213E0009X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H213E0010X 1 "1 HAS MPC DATA" 2 "2 NO MPC DATA" ; label define H213E0011X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H213E0012X 23 "PANEL 23" 24 "PANEL 24" ; label define H213E0013X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H213E0014X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H213E0015X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H213E0016X -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 DIAGNOSIS OR TREATMENT" 2 "2 EMERGENCY (E.G., ACCIDENT OR INJURY)" 3 "3 PSYCHOTHERAPY/MENTAL HEALTH COUNSELING" 4 "4 FOLLOW-UP OR POST-OPERATIVE VISIT" 5 "5 IMMUNIZATIONS OR SHOTS" 6 "6 PREGNANCY-RELATED (INC PRENATAL/ DELV)" 91 "91 OTHER" ; label define H213E0017X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H213E0018X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value EKG_M18 H213E0001X; label value ERDATEMM H213E0002X; label value ERDATEYR H213E0003X; label value EVENTRN H213E0004X; label value FFERTYPE H213E0005X; label value IMPFLAG H213E0006X; label value LABTEST_M18 H213E0007X; label value MAMMOG_M18 H213E0008X; label value MEDPRESC H213E0009X; label value MPCDATA H213E0010X; label value MRI_M18 H213E0011X; label value PANEL H213E0012X; label value RCVVAC_M18 H213E0013X; label value SONOGRAM_M18 H213E0014X; label value SURGPROC H213E0015X; label value VSTCTGRY H213E0016X; label value VSTRELCN H213E0017X; label value XRAYS_M18 H213E0018X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H213E, replace; #delimit cr * data file is stored in H213E.dta * log file is stored in H213E.log log close /************************************************************************************************ NOTES: 1. This program has been tested on Stata Version 10 (for Windows). 2. This program will create a permanent Stata dataset. All additional analyses can be run using this dataset. In addition to the dataset, this program creates a log file named H213E.LOG and a data file named H213E.DTA. If these files (H213E.DTA and H213E.LOG) already exist in the working directory, they will be replaced when this program is executed. 3. If the program ends prematurely, the log file will remain open. Before running this program again, the user should enter the following Stata command: log close 4. The cd command assigns C:\MEPS\DATA as the working directory and location of the input ASCII and output .DTA and .LOG files and can be modified by the user as necessary. 5. Stata commands end with a carriage return by default. The command #delimit ; temporarily changes the command ending delimiter from a carriage return to a semicolon. 6. The infix command assumes that the input variables are numeric unless the variable name is prefaced by str. For example, DUPERSID is the a string (or character) variable. ************************************************************************************************/