/************************************************************************************************/ /* Stata User File for H162 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 */ /* (H162.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 H162.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\H162.DO */ /* The program below will output the Stata dataset H162.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H162.log, replace; clear; * INPUT ALL VARIABLES; infix str DUID 1-5 int PID 6-8 str DUPERSID 9-16 int CONDN 17-19 str CONDIDX 20-31 byte PANEL 32-33 byte CONDRN 34-34 byte AGEDIAG 35-36 byte CRND1 37-38 byte CRND2 39-40 byte CRND3 41-41 byte CRND4 42-43 byte CRND5 44-45 byte INJURY 46-46 byte ACCDNWRK 47-48 str ICD9CODX 49-51 str ICD9PROX 52-53 str CCCODEX 54-56 byte HHNUM 57-58 byte IPNUM 59-60 int OPNUM 61-63 int OBNUM 64-66 byte ERNUM 67-68 byte RXNUM 69-70 double PERWT13F 71-82 int VARSTR 83-86 byte VARPSU 87-87 using H162.dat; *DEFINE VARIABLE LABELS; label variable DUID "DWELLING UNIT ID"; 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 ICD9CODX "ICD-9-CM CODE FOR CONDITION - EDITED"; label variable ICD9PROX "ICD-9-CM CODE FOR PROCEDURE - EDITED"; label variable CCCODEX "CLINICAL CLASSIFICATION CODE - EDITED"; label variable HHNUM "# HOME HEALTH EVENTS ASSOC. W/ CONDITION"; label variable IPNUM "# INPATIENT EVENTS ASSOC. W/ CONDITION"; label variable OPNUM "# OUTPATIENT EVENTS ASSOC. W/ CONDITION"; label variable OBNUM "# OFFICE-BASED EVENTS ASSOC W/ CONDITION"; label variable ERNUM "# ER EVENTS ASSOC. W/ CONDITION"; label variable RXNUM "# PRESCRIBED MEDICINES ASSOC. W/ COND."; label variable PERWT13F "EXPENDITURE FILE PERSON WEIGHT, 2013"; label variable VARSTR "VARIANCE ESTIMATION STRATUM, 2013"; label variable VARPSU "VARIANCE ESTIMATION PSU, 2013"; *DEFINE VALUE LABELS FOR REPORTS; label define H1620001X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 YES" 2 "2 NO" 3 "3 DOES NOT WORK" ; label define H1620002X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" ; label define H1620003X 1 "1 ROUND 1" 2 "2 ROUND 2" 3 "3 ROUND 3" 4 "4 ROUND 4" 5 "5 ROUND 5" ; label define H1620004X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H1620005X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H1620006X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H1620007X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H1620008X -1 "-1 INAPPLICABLE" 0 "0 NO" 1 "1 YES" ; label define H1620009X -9 "-9 NOT ASCERTAINED" 1 "1 YES" 2 "2 NO" ; label define H1620010X 17 "17 PANEL 17" 18 "18 PANEL 18" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value ACCDNWRK H1620001X; label value AGEDIAG H1620002X; label value CONDRN H1620003X; label value CRND1 H1620004X; label value CRND2 H1620005X; label value CRND3 H1620006X; label value CRND4 H1620007X; label value CRND5 H1620008X; label value INJURY H1620009X; label value PANEL H1620010X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H162, replace; #delimit cr * data file is stored in H162.dta * log file is stored in H162.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 H162.LOG and a data file named H162.DTA. If these files (H162.DTA and H162.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. ************************************************************************************************/