/************************************************************************************************/ /* Stata User File for H206D 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 */ /* (H206D.DAT) supplied in this PUF release, which in turn can be extracted from the */ /* .EXE file. 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 H206D.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\H206D.DO */ /* The program below will output the Stata dataset H206D.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H206D.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 byte RSNINHOS 87-88 byte ANYOPER 89-90 byte DSCHPMED 91-92 byte FFIPTYPE 93-94 double IPXP18X 95-103 double IPTC18X 104-113 double IPFSF18X 114-121 double IPFMR18X 122-130 double IPFMD18X 131-139 double IPFPV18X 140-148 double IPFVA18X 149-157 double IPFTR18X 158-165 double IPFOF18X 166-173 double IPFSL18X 174-181 double IPFWC18X 182-189 double IPFOR18X 190-197 double IPFOU18X 198-205 double IPFOT18X 206-214 double IPFXP18X 215-223 double IPFTC18X 224-233 double IPDSF18X 234-240 double IPDMR18X 241-247 double IPDMD18X 248-255 double IPDPV18X 256-263 double IPDVA18X 264-271 double IPDTR18X 272-278 double IPDOF18X 279-282 double IPDSL18X 283-288 double IPDWC18X 289-295 double IPDOR18X 296-302 double IPDOU18X 303-309 double IPDOT18X 310-317 double IPDXP18X 318-325 double IPDTC18X 326-333 byte IMPFLAG 334-334 double PERWT18F 335-346 int VARSTR 347-350 byte VARPSU 351-351 using H206D.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 IPXP18X "TOTAL EXP FOR EVENT (IPFXP18X+IPDXP18X)"; label variable IPTC18X "TOTAL CHG FOR EVENT (IPFTC18X+IPDTC18X)"; label variable IPFSF18X "FACILITY AMOUNT PAID, FAMILY (IMPUTED)"; label variable IPFMR18X "FACILITY AMOUNT PAID, MEDICARE (IMPUTED)"; label variable IPFMD18X "FACILITY AMOUNT PAID, MEDICAID (IMPUTED)"; label variable IPFPV18X "FACILITY AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable IPFVA18X "FACILITY AMOUNT PAID,VETERANS/CHAMPVA(IMPUTED)"; label variable IPFTR18X "FACILITY AMOUNT PAID,TRICARE(IMPUTED)"; label variable IPFOF18X "FACILITY AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable IPFSL18X "FACILITY AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable IPFWC18X "FACILITY AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable IPFOR18X "FACILITY AMOUNT PAID, OTH PRIV (IMPUTED)"; label variable IPFOU18X "FACILITY AMOUNT PAID, OTH PUB (IMPUTED)"; label variable IPFOT18X "FACILITY AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable IPFXP18X "FACILITY SUM PAYMENTS IPFSF18X-IPFOT18X"; label variable IPFTC18X "TOTAL FACILITY CHARGE (IMPUTED)"; label variable IPDSF18X "DOCTOR AMOUNT PAID, FAMILY (IMPUTED)"; label variable IPDMR18X "DOCTOR AMOUNT PAID, MEDICARE (IMPUTED)"; label variable IPDMD18X "DOCTOR AMOUNT PAID, MEDICAID (IMPUTED)"; label variable IPDPV18X "DOCTOR AMOUNT PAID, PRIV INSUR (IMPUTED)"; label variable IPDVA18X "DOCTOR AMOUNT PAID,VETERANS/CHAMPVA(IMPUTED)"; label variable IPDTR18X "DOCTOR AMOUNT PAID,TRICARE(IMPUTED)"; label variable IPDOF18X "DOCTOR AMOUNT PAID, OTH FEDERAL (IMPUTED)"; label variable IPDSL18X "DOCTOR AMOUNT PAID, STATE/LOC GOV (IMPUTED)"; label variable IPDWC18X "DOCTOR AMOUNT PAID, WORKERS COMP (IMPUTED)"; label variable IPDOR18X "DOCTOR AMOUNT PAID, OTH PRIV (IMPUTED)"; label variable IPDOU18X "DOCTOR AMOUNT PAID, OTH PUB (IMPUTED)"; label variable IPDOT18X "DOCTOR AMOUNT PAID, OTH INSUR (IMPUTED)"; label variable IPDXP18X "DOCTOR SUM PAYMENTS IPDSF18X-IPDOT18X"; label variable IPDTC18X "TOTAL DOCTOR CHARGE (IMPUTED)"; label variable IMPFLAG "IMPUTATION STATUS"; label variable PERWT18F "EXPENDITURE FILE PERSON WEIGHT, 2018"; label variable VARSTR "VARIANCE ESTIMATION STRATUM, 2018"; label variable VARPSU "VARIANCE ESTIMATION PSU, 2018"; *DEFINE VALUE LABELS FOR REPORTS; label define H206D0001X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H206D0002X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H206D0003X 1 "1 YES" 2 "2 NO" ; label define H206D0004X 1 "ROUND 1" 2 "ROUND 2" 3 "ROUND 3" 4 "ROUND 4" 5 "ROUND 5" ; label define H206D0005X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 FLAT FEE STEM" 2 "2 FLAT FEE LEAF" ; label define H206D0006X 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 H206D0007X -7 "-7 REFUSED" -8 "-8 DK" ; label define H206D0008X -7 "-7 REFUSED" -8 "-8 DK" 2017 "2017" 2018 "2018" ; label define H206D0009X -7 "-7 REFUSED" -8 "-8 DK" ; label define H206D0010X -7 "-7 REFUSED" -8 "-8 DK" 2018 "2018" ; label define H206D0011X 1 "1 HAS MPC DATA" 2 "2 NO MPC DATA" ; label define H206D0012X 22 "PANEL 22" 23 "PANEL 23" ; label define H206D0013X -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 H206D0014X -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value ANYOPER H206D0001X; label value DSCHPMED H206D0002X; label value EMERROOM H206D0003X; label value EVENTRN H206D0004X; label value FFIPTYPE H206D0005X; label value IMPFLAG H206D0006X; label value IPBEGMM H206D0007X; label value IPBEGYR H206D0008X; label value IPENDMM H206D0009X; label value IPENDYR H206D0010X; label value MPCDATA H206D0011X; label value PANEL H206D0012X; label value RSNINHOS H206D0013X; label value SPECCOND H206D0014X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H206D, replace; #delimit cr * data file is stored in H206D.dta * log file is stored in H206D.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 H206D.LOG and a data file named H206D.DTA. If these files (H206D.DTA and H206D.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. ************************************************************************************************/