/************************************************************************************************/ /* Stata User File for H248D 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 */ /* (H248D.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 H248D.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\H248D.DO */ /* The program below will output the Stata dataset H248D.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H248D.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 IPXP23X 96-104 double IPTC23X 105-114 double IPFSF23X 115-123 double IPFMR23X 124-132 double IPFMD23X 133-141 double IPFPV23X 142-150 double IPFVA23X 151-159 double IPFTR23X 160-168 double IPFOF23X 169-176 double IPFSL23X 177-184 double IPFWC23X 185-192 double IPFOT23X 193-200 double IPFXP23X 201-209 double IPFTC23X 210-219 double IPDSF23X 220-226 double IPDMR23X 227-234 double IPDMD23X 235-242 double IPDPV23X 243-251 double IPDVA23X 252-258 double IPDTR23X 259-265 double IPDOF23X 266-269 double IPDSL23X 270-276 double IPDWC23X 277-283 double IPDOT23X 284-290 double IPDXP23X 291-299 double IPDTC23X 300-308 byte IMPFLAG 309-309 double PERWT23F 310-321 int VARSTR 322-325 byte VARPSU 326-326 using H248D.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 IPXP23X "TOTAL EXP FOR EVENT (IPFXP23X + IPDXP23X)"; label variable IPTC23X "TOTAL CHG FOR EVENT (IPFTC23X + IPDTC23X)"; label variable IPFSF23X "FACILITY AMOUNT PAID, FAMILY (IMPUTED)"; label variable IPFMR23X "FACILITY AMOUNT PAID, MEDICARE (IMPUTED)"; label variable IPFMD23X "FACILITY AMOUNT PAID, MEDICAID (IMPUTED)"; label variable IPFPV23X "FACILITY AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable IPFVA23X "FACILITY AMOUNT PAID, VETERANS/CHAMPVA (IMPUTED)"; label variable IPFTR23X "FACILITY AMOUNT PAID, TRICARE (IMPUTED)"; label variable IPFOF23X "FACILITY AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable IPFSL23X "FACILITY AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable IPFWC23X "FACILITY AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable IPFOT23X "FACILITY AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable IPFXP23X "FACILITY SUM PAYMENTS IPFSF23X - IPFOT23X"; label variable IPFTC23X "TOTAL FACILITY CHARGE (IMPUTED)"; label variable IPDSF23X "DOCTOR AMOUNT PAID, FAMILY (IMPUTED)"; label variable IPDMR23X "DOCTOR AMOUNT PAID, MEDICARE (IMPUTED)"; label variable IPDMD23X "DOCTOR AMOUNT PAID, MEDICAID (IMPUTED)"; label variable IPDPV23X "DOCTOR AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable IPDVA23X "DOCTOR AMOUNT PAID, VETERANS/CHAMPVA (IMPUTED)"; label variable IPDTR23X "DOCTOR AMOUNT PAID, TRICARE (IMPUTED)"; label variable IPDOF23X "DOCTOR AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable IPDSL23X "DOCTOR AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable IPDWC23X "DOCTOR AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable IPDOT23X "DOCTOR AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable IPDXP23X "DOCTOR SUM PAYMENTS IPDSF23X - IPDOT23X"; label variable IPDTC23X "TOTAL DOCTOR CHARGE (IMPUTED)"; label variable IMPFLAG "IMPUTATION STATUS"; label variable PERWT23F "EXPENDITURE FILE PERSON WEIGHT, 2023"; label variable VARSTR "VARIANCE ESTIMATION STRATUM, 2023"; label variable VARPSU "VARIANCE ESTIMATION PSU, 2023"; *DEFINE VALUE LABELS FOR REPORTS; label define H248D0001X -7 "-7 REFUSED" -8 "-8 DON'T KNOW" 1 "1 YES" 2 "2 NO" ; label define H248D0002X -7 "-7 REFUSED" -8 "-8 DON'T KNOW" 1 "1 YES" 2 "2 NO" ; label define H248D0003X 1 "1 YES" 2 "2 NO" ; label define H248D0004X 1 "1 ROUND 1" 2 "2 ROUND 2" 3 "3 ROUND 3" 4 "4 ROUND 4" 5 "5 ROUND 5" ; label define H248D0005X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DON'T KNOW" 1 "1 FLAT FEE STEM" 2 "2 FLAT FEE LEAF" ; label define H248D0006X 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 H248D0007X -7 "-7 REFUSED" -8 "-8 DON'T KNOW" ; label define H248D0008X -7 "-7 REFUSED" -8 "-8 DON'T KNOW" 2022 "2022" 2023 "2023" ; label define H248D0009X -7 "-7 REFUSED" -8 "-8 DON'T KNOW" ; label define H248D0010X -7 "-7 REFUSED" -8 "-8 DON'T KNOW" 2023 "2023" ; label define H248D0011X 1 "1 HAS MPC DATA" 2 "2 NO MPC DATA" ; label define H248D0012X 27 "27 PANEL 27" 28 "28 PANEL 28" ; label define H248D0013X -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DON'T KNOW" 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 H248D0014X -7 "-7 REFUSED" -8 "-8 DON'T KNOW" 1 "1 YES" 2 "2 NO" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value ANYOPER H248D0001X; label value DSCHPMED H248D0002X; label value EMERROOM H248D0003X; label value EVENTRN H248D0004X; label value FFIPTYPE H248D0005X; label value IMPFLAG H248D0006X; label value IPBEGMM H248D0007X; label value IPBEGYR H248D0008X; label value IPENDMM H248D0009X; label value IPENDYR H248D0010X; label value MPCDATA H248D0011X; label value PANEL H248D0012X; label value RSNINHOS H248D0013X; label value SPECCOND H248D0014X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H248D, replace; #delimit cr * data file is stored in H248D.dta * log file is stored in H248D.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 H248D.LOG and a data file named H248D.DTA. If these files (H248D.DTA and H248D.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. ************************************************************************************************/