/************************************************************************************************/ /* Stata User File for H197IF2 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 */ /* (H197IF2.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 H197IF2.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\H197IF2.DO */ /* The program below will output the Stata dataset H197IF2.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H197IF2.log, replace; clear; * INPUT ALL VARIABLES; infix str DUPERSID 1-8 str RXLKIDX 9-32 str EVNTIDX 33-44 str LINKIDX 45-56 byte EVENTYPE 57-57 byte PANEL 58-59 using H197IF2.dat; *DEFINE VARIABLE LABELS; label variable DUPERSID "PERSON ID (DUID + PID)"; label variable RXLKIDX "RECORD ID: EVNTIDX + LINKIDX"; label variable EVNTIDX "EVENT ID"; label variable LINKIDX "ID FOR LINKAGE TO COND/OTH EVENT FILES"; label variable EVENTYPE "TYPE OF EVENT RX IS LINKED TO"; label variable PANEL "PANEL NUMBER"; *DEFINE VALUE LABELS FOR REPORTS; label define H197IF20001X 1 "1 MVIS" 2 "2 OPAT" 3 "3 EROM" 4 "4 STAZ" 5 "5 DVIS" 6 "6 OMED" 7 "7 HVIS" 8 "8 PMED" ; label define H197IF20002X 21 "21 PANEL 21" 22 "22 PANEL 22" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value EVENTYPE H197IF20001X; label value PANEL H197IF20002X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H197IF2, replace; #delimit cr * data file is stored in H197IF2.dta * log file is stored in H197IF2.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 H197IF2.LOG and a data file named H197IF2.DTA. If these files (H197IF2.DTA and H197IF2.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. ************************************************************************************************/