/************************************************************************************************/ /* Stata User File for H231 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 */ /* (H231.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 H231.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\H231.DO */ /* The program below will output the Stata dataset H231.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H231.log, replace; clear; * INPUT ALL VARIABLES; infix str DUID 1-7 int PID 8-10 str DUPERSID 11-20 int CONDN 21-23 str CONDIDX 24-36 byte PANEL 37-38 byte CONDRN 39-39 int AGEDIAG 40-42 byte CRND1 43-44 byte CRND2 45-46 byte CRND3 47-48 byte CRND4 49-50 byte CRND5 51-52 byte CRND6 53-54 byte CRND7 55-56 byte CRND8 57-58 byte CRND9 59-60 byte INJURY 61-61 int ACCDNWRK 62-64 str ICD10CDX 65-72 str CCSR1X 73-78 str CCSR2X 79-84 str CCSR3X 85-90 byte HHCOND 91-91 byte IPCOND 92-92 byte OPCOND 93-93 byte OBCOND 94-94 byte ERCOND 95-95 byte RXCOND 96-96 double PERWT21F 97-108 int VARSTR 109-112 byte VARPSU 113-113 using H231.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 CRND6 "HAS CONDITION INFORMATION IN ROUND 6"; label variable CRND7 "HAS CONDITION INFORMATION IN ROUND 7"; label variable CRND8 "HAS CONDITION INFORMATION IN ROUND 8"; label variable CRND9 "HAS CONDITION INFORMATION IN ROUND 9"; 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 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 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 H2310001X -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 H2310002X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" ; label define H2310003X 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 H2310004X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310005X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310006X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310007X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310008X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310009X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310010X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310011X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310012X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H2310013X 1 "1 YES" 2 "2 NO" ; label define H2310014X 1 "1 YES" 2 "2 NO" ; label define H2310015X -15 "-15 CANNOT BE COMPUTED" 1 "1 YES" 2 "2 NO" ; label define H2310016X 1 "1 YES" 2 "2 NO" ; label define H2310017X 1 "1 YES" 2 "2 NO" ; label define H2310018X 1 "1 YES" 2 "2 NO" ; label define H2310019X 23 "23 PANEL 23" 24 "24 PANEL 24" 25 "25 PANEL 25" 26 "26 PANEL 26" ; label define H2310020X 1 "1 YES" 2 "2 NO" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value ACCDNWRK H2310001X; label value AGEDIAG H2310002X; label value CONDRN H2310003X; label value CRND1 H2310004X; label value CRND2 H2310005X; label value CRND3 H2310006X; label value CRND4 H2310007X; label value CRND5 H2310008X; label value CRND6 H2310009X; label value CRND7 H2310010X; label value CRND8 H2310011X; label value CRND9 H2310012X; label value ERCOND H2310013X; label value HHCOND H2310014X; label value INJURY H2310015X; label value IPCOND H2310016X; label value OBCOND H2310017X; label value OPCOND H2310018X; label value PANEL H2310019X; label value RXCOND H2310020X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H231, replace; #delimit cr * data file is stored in H231.dta * log file is stored in H231.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 H231.LOG and a data file named H231.DTA. If these files (H231.DTA and H231.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. ************************************************************************************************/