/************************************************************************************************/ /* Stata User File for H213D 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 */ /* (H213D.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 H213D.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\H213D.DO */ /* The program below will output the Stata dataset H213D.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H213D.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 IPBEGYR 69-72 byte IPBEGMM 73-74 int IPENDYR 75-78 byte IPENDMM 79-80 int NUMNIGHX 81-83 byte EMERROOM 84-84 byte SPECCOND 85-86 int RSNINHOS 87-89 byte ANYOPER 90-91 byte DSCHPMED 92-93 byte FFIPTYPE 94-95 double IPXP19X 96-104 double IPTC19X 105-114 double IPFSF19X 115-122 double IPFMR19X 123-131 double IPFMD19X 132-140 double IPFPV19X 141-149 double IPFVA19X 150-158 double IPFTR19X 159-166 double IPFOF19X 167-174 double IPFSL19X 175-182 double IPFWC19X 183-190 double IPFOT19X 191-198 double IPFXP19X 199-207 double IPFTC19X 208-217 double IPDSF19X 218-224 double IPDMR19X 225-232 double IPDMD19X 233-240 double IPDPV19X 241-248 double IPDVA19X 249-256 double IPDTR19X 257-263 double IPDOF19X 264-267 double IPDSL19X 268-273 double IPDWC19X 274-281 double IPDOT19X 282-288 double IPDXP19X 289-296 double IPDTC19X 297-304 byte IMPFLAG 305-305 double PERWT19F 306-317 int VARSTR 318-321 byte VARPSU 322-322 using H213D.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 EMER RM VISIT"; label variable FFEEIDX "FLAT FEE ID"; label variable PANEL "PANEL NUMBER"; label variable MPCDATA "MPC DATA FLAG"; label variable IPBEGYR "EVENT START DATE - YEAR"; label variable IPBEGMM "EVENT START DATE - MONTH"; label variable IPENDYR "EVENT END DATE - YEAR"; label variable IPENDMM "EVENT END DATE - MONTH"; label variable NUMNIGHX "# OF NIGHTS IN HOSPITAL - EDITED/IMPUTED"; label variable EMERROOM "DID STAY BEGIN WITH EMERGENCY ROOM VISIT"; label variable SPECCOND "HOSPITAL STAY RELATED TO CONDITION"; label variable RSNINHOS "REASON ENTERED HOSPITAL"; label variable ANYOPER "ANY OPERATIONS OR SURGERIES PERFORMED"; label variable DSCHPMED "MEDICINES PRESCRIBED AT DISCHARGE"; label variable FFIPTYPE "FLAT FEE BUNDLE"; label variable IPXP19X "TOTAL EXP FOR EVENT (IPFXP19X + IPDXP19X)"; label variable IPTC19X "TOTAL CHG FOR EVENT (IPFTC19X + IPDTC19X)"; label variable IPFSF19X "FACILITY AMOUNT PAID, FAMILY (IMPUTED)"; label variable IPFMR19X "FACILITY AMOUNT PAID, MEDICARE (IMPUTED)"; label variable IPFMD19X "FACILITY AMOUNT PAID, MEDICAID (IMPUTED)"; label variable IPFPV19X "FACILITY AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable IPFVA19X "FACILITY AMOUNT PAID, VETERANS/CHAMPVA(IMPUTED)"; label variable IPFTR19X "FACILITY AMOUNT PAID, TRICARE(IMPUTED)"; label variable IPFOF19X "FACILITY AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable IPFSL19X "FACILITY AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable IPFWC19X "FACILITY AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable IPFOT19X "FACILITY AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable IPFXP19X "FACILITY SUM PAYMENTS IPFSF19X - IPFOT19X"; label variable IPFTC19X "TOTAL FACILITY CHARGE (IMPUTED)"; label variable IPDSF19X "DOCTOR AMOUNT PAID, FAMILY (IMPUTED)"; label variable IPDMR19X "DOCTOR AMOUNT PAID, MEDICARE (IMPUTED)"; label variable IPDMD19X "DOCTOR AMOUNT PAID, MEDICAID (IMPUTED)"; label variable IPDPV19X "DOCTOR AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable IPDVA19X "DOCTOR AMOUNT PAID, VETERANS/CHAMPVA(IMPUTED)"; label variable IPDTR19X "DOCTOR AMOUNT PAID, TRICARE(IMPUTED)"; label variable IPDOF19X "DOCTOR AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable IPDSL19X "DOCTOR AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable IPDWC19X "DOCTOR AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable IPDOT19X "DOCTOR AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable IPDXP19X "DOCTOR SUM PAYMENTS IPDSF19X - IPDOT19X"; label variable IPDTC19X "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 H213D0001X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H213D0002X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H213D0003X 1 "1 YES" 2 "2 NO" ; label define H213D0004X 1 "ROUND 1" 2 "ROUND 2" 3 "ROUND 3" 4 "ROUND 4" 5 "ROUND 5" ; label define H213D0005X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 FLAT FEE STEM" 2 "2 FLAT FEE LEAF" ; label define H213D0006X 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 H213D0007X -7 "-7 REFUSED" -8 "-8 DK" ; label define H213D0008X -7 "-7 REFUSED" -8 "-8 DK" 2018 "2018" 2019 "2019" ; label define H213D0009X -7 "-7 REFUSED" -8 "-8 DK" ; label define H213D0010X -7 "-7 REFUSED" -8 "-8 DK" 2019 "2019" ; label define H213D0011X 1 "1 HAS MPC DATA" 2 "2 NO MPC DATA" ; label define H213D0012X 23 "PANEL 23" 24 "PANEL 24" ; label define H213D0013X -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 OPERATION OR SURGICAL PROCEDURE" 2 "2 TREATMENT/THERAPY" 3 "3 DIAGNOSTIC TESTS ONLY" 4 "4 GIVE BIRTH TO A BABY (MOTHER)" 5 "5 TO BE BORN (BABY)" 6 "6 PREGNANCY-RELATED COMPLICATIONS" 91 "91 OTHER (SPECIFY)" ; label define H213D0014X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value ANYOPER H213D0001X; label value DSCHPMED H213D0002X; label value EMERROOM H213D0003X; label value EVENTRN H213D0004X; label value FFIPTYPE H213D0005X; label value IMPFLAG H213D0006X; label value IPBEGMM H213D0007X; label value IPBEGYR H213D0008X; label value IPENDMM H213D0009X; label value IPENDYR H213D0010X; label value MPCDATA H213D0011X; label value PANEL H213D0012X; label value RSNINHOS H213D0013X; label value SPECCOND H213D0014X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H213D, replace; #delimit cr * data file is stored in H213D.dta * log file is stored in H213D.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 H213D.LOG and a data file named H213D.DTA. If these files (H213D.DTA and H213D.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. ************************************************************************************************/