/************************************************************************************************/ /* Stata User File for H229E 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 */ /* (H229E.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 H229E.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\H229E.DO */ /* The program below will output the Stata dataset H229E.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H229E.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 int VSTCTGRY 75-77 byte VSTRELCN 78-79 byte LABTEST_M18 80-81 byte SONOGRAM_M18 82-83 byte XRAYS_M18 84-85 byte MAMMOG_M18 86-87 byte MRI_M18 88-89 byte EKG_M18 90-91 byte RCVVAC_M18 92-93 byte SURGPROC 94-95 byte MEDPRESC 96-97 byte FFERTYPE 98-99 double ERXP21X 100-107 double ERTC21X 108-116 double ERFSF21X 117-123 double ERFMR21X 124-131 double ERFMD21X 132-139 double ERFPV21X 140-147 double ERFVA21X 148-154 double ERFTR21X 155-161 double ERFOF21X 162-168 double ERFSL21X 169-176 double ERFWC21X 177-184 double ERFOT21X 185-192 double ERFXP21X 193-200 double ERFTC21X 201-209 double ERDSF21X 210-216 double ERDMR21X 217-223 double ERDMD21X 224-231 double ERDPV21X 232-238 double ERDVA21X 239-245 double ERDTR21X 246-251 double ERDOF21X 252-257 double ERDSL21X 258-263 double ERDWC21X 264-270 double ERDOT21X 271-277 double ERDXP21X 278-285 double ERDTC21X 286-293 byte IMPFLAG 294-294 double PERWT21F 295-306 int VARSTR 307-310 byte VARPSU 311-311 using H229E.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 ERXP21X "TOTAL EXP FOR EVENT (ERFXP21X + ERDXP21X)"; label variable ERTC21X "TOTAL CHG FOR EVENT (ERFTC21X + ERDTC21X)"; label variable ERFSF21X "FACILITY AMOUNT PAID, FAMILY (IMPUTED)"; label variable ERFMR21X "FACILITY AMOUNT PAID, MEDICARE (IMPUTED)"; label variable ERFMD21X "FACILITY AMOUNT PAID, MEDICAID (IMPUTED)"; label variable ERFPV21X "FACILITY AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable ERFVA21X "FACILITY AMOUNT PAID, VETERANS/CHAMPVA (IMPUTED)"; label variable ERFTR21X "FACILITY AMOUNT PAID, TRICARE (IMPUTED)"; label variable ERFOF21X "FACILITY AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable ERFSL21X "FACILITY AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable ERFWC21X "FACILITY AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable ERFOT21X "FACILITY AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable ERFXP21X "FACILITY SUM PAYMENTS ERFSF21X - ERFOT21X"; label variable ERFTC21X "TOTAL FACILITY CHARGE (IMPUTED)"; label variable ERDSF21X "DOCTOR AMOUNT PAID, FAMILY (IMPUTED)"; label variable ERDMR21X "DOCTOR AMOUNT PAID, MEDICARE (IMPUTED)"; label variable ERDMD21X "DOCTOR AMOUNT PAID, MEDICAID (IMPUTED)"; label variable ERDPV21X "DOCTOR AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable ERDVA21X "DOCTOR AMOUNT PAID, VETERANS/CHAMPVA (IMPUTED)"; label variable ERDTR21X "DOCTOR AMOUNT PAID, TRICARE (IMPUTED)"; label variable ERDOF21X "DOCTOR AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable ERDSL21X "DOCTOR AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable ERDWC21X "DOCTOR AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable ERDOT21X "DOCTOR AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable ERDXP21X "DOCTOR SUM PAYMENTS ERDSF21X - ERDOT21X"; label variable ERDTC21X "TOTAL DOCTOR CHARGE (IMPUTED)"; label variable IMPFLAG "IMPUTATION STATUS"; label variable PERWT21F "EXPENDITURE FILE PERSON WEIGHT, 2021"; label variable VARSTR "VARIANCE ESTIMATION STRATUM, 2021"; label variable VARPSU "VARIANCE ESTIMATION PSU, 2021"; *DEFINE VALUE LABELS FOR REPORTS; label define H229E0001X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H229E0002X -7 "-7 REFUSED" -8 "-8 DK" ; label define H229E0003X -7 "-7 REFUSED" -8 "-8 DK" 2021 "2021" ; label define H229E0004X 1 "1 ROUND 1" 2 "2 ROUND 2" 3 "3 ROUND 3" 4 "4 ROUND 4" 5 "5 ROUND 5" 6 "6 ROUND 6" 7 "7 ROUND 7" 8 "8 ROUND 8" 9 "9 ROUND 9" ; label define H229E0005X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 FLAT FEE STEM" 2 "2 FLAT FEE LEAF" ; label define H229E0006X 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 H229E0007X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H229E0008X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H229E0009X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H229E0010X 1 "1 HAS MPC DATA" 2 "2 NO MPC DATA" ; label define H229E0011X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H229E0012X 23 "23 PANEL 23" 24 "24 PANEL 24" 25 "25 PANEL 25" 26 "26 PANEL 26" ; label define H229E0013X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H229E0014X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 95 "95 NO SERVICES RECEIVED" ; label define H229E0015X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H229E0016X -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 H229E0017X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H229E0018X -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 H229E0001X; label value ERDATEMM H229E0002X; label value ERDATEYR H229E0003X; label value EVENTRN H229E0004X; label value FFERTYPE H229E0005X; label value IMPFLAG H229E0006X; label value LABTEST_M18 H229E0007X; label value MAMMOG_M18 H229E0008X; label value MEDPRESC H229E0009X; label value MPCDATA H229E0010X; label value MRI_M18 H229E0011X; label value PANEL H229E0012X; label value RCVVAC_M18 H229E0013X; label value SONOGRAM_M18 H229E0014X; label value SURGPROC H229E0015X; label value VSTCTGRY H229E0016X; label value VSTRELCN H229E0017X; label value XRAYS_M18 H229E0018X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H229E, replace; #delimit cr * data file is stored in H229E.dta * log file is stored in H229E.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 H229E.LOG and a data file named H229E.DTA. If these files (H229E.DTA and H229E.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. ************************************************************************************************/