/************************************************************************************************/ /* Stata User File for H249 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 */ /* (H249.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 H249.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\H249.DO */ /* The program below will output the Stata dataset H249.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H249.log, replace; clear; * INPUT ALL VARIABLES; infix str DUID 1-7 int PID 8-10 str DUPERSID 11-20 byte CONDN 21-22 str CONDIDX 23-35 byte PANEL 36-37 byte CONDRN 38-38 int AGEDIAG 39-41 byte CRND1 42-43 byte CRND2 44-45 byte CRND3 46-46 byte CRND4 47-48 byte CRND5 49-50 byte INJURY 51-51 int ACCDNWRK 52-54 str ICD10CDX 55-62 str CCSR1X 63-68 str CCSR2X 69-74 str CCSR3X 75-80 str CCSR4X 81-86 byte HHCOND 87-87 byte IPCOND 88-88 byte OPCOND 89-89 byte OBCOND 90-90 byte ERCOND 91-91 byte RXCOND 92-92 double PERWT23F 93-105 int VARSTR 106-109 byte VARPSU 110-110 using H249.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 CONDN "CONDITION NUMBER"; label variable CONDIDX "CONDITION ID"; label variable PANEL "PANEL NUMBER"; label variable CONDRN "CONDITION ROUND NUMBER"; label variable AGEDIAG "AGE WHEN DIAGNOSED"; label variable CRND1 "HAS CONDITION INFORMATION IN ROUND 1"; label variable CRND2 "HAS CONDITION INFORMATION IN ROUND 2"; label variable CRND3 "HAS CONDITION INFORMATION IN ROUND 3"; label variable CRND4 "HAS CONDITION INFORMATION IN ROUND 4"; label variable CRND5 "HAS CONDITION INFORMATION IN ROUND 5"; label variable INJURY "WAS CONDITION DUE TO ACCIDENT/INJURY"; label variable ACCDNWRK "DID ACCIDENT OCCUR AT WORK"; label variable ICD10CDX "ICD-10-CM CODE FOR CONDITION - EDITED"; label variable CCSR1X "CLINICAL CLASSIFICATION REFINED CODE 1- EDITED"; label variable CCSR2X "CLINICAL CLASSIFICATION REFINED CODE 2- EDITED"; label variable CCSR3X "CLINICAL CLASSIFICATION REFINED CODE 3- EDITED"; label variable CCSR4X "CLINICAL CLASSIFICATION REFINED CODE 4- EDITED"; label variable HHCOND "ANY HOME HEALTH EVENTS ASSOC. W/ CONDITION?"; label variable IPCOND "ANY INPATIENT EVENTS ASSOC. W/ CONDITION?"; label variable OPCOND "ANY OUTPATIENT EVENTS ASSOC. W/ CONDITION?"; label variable OBCOND "ANY OFFICE-BASED EVENTS ASSOC. W/ CONDITION?"; label variable ERCOND "ANY ER EVENTS ASSOC. W/ CONDITION?"; label variable RXCOND "ANY PRESCRIBED MEDICINES ASSOC. W/ COND.?"; 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 H2490001X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" 3 "3 DOES NOT WORK" ; label define H2490002X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" ; label define H2490003X 1 "1 ROUND 1" 2 "2 ROUND 2" 3 "3 ROUND 3" 4 "4 ROUND 4" 5 "5 ROUND 5" ; label define H2490004X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2490005X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2490006X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2490007X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2490008X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2490009X 1 "1 YES" 2 "2 NO" ; label define H2490010X 1 "1 YES" 2 "2 NO" ; label define H2490011X -15 "-15 CANNOT BE COMPUTED" 1 "1 YES" 2 "2 NO" ; label define H2490012X 1 "1 YES" 2 "2 NO" ; label define H2490013X 1 "1 YES" 2 "2 NO" ; label define H2490014X 1 "1 YES" 2 "2 NO" ; label define H2490015X 27 "27 PANEL 27" 28 "28 PANEL 28" ; label define H2490016X 1 "1 YES" 2 "2 NO" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value ACCDNWRK H2490001X; label value AGEDIAG H2490002X; label value CONDRN H2490003X; label value CRND1 H2490004X; label value CRND2 H2490005X; label value CRND3 H2490006X; label value CRND4 H2490007X; label value CRND5 H2490008X; label value ERCOND H2490009X; label value HHCOND H2490010X; label value INJURY H2490011X; label value IPCOND H2490012X; label value OBCOND H2490013X; label value OPCOND H2490014X; label value PANEL H2490015X; label value RXCOND H2490016X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H249, replace; #delimit cr * data file is stored in H249.dta * log file is stored in H249.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 H249.LOG and a data file named H249.DTA. If these files (H249.DTA and H249.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. ************************************************************************************************/