/************************************************************************************************/ /* Stata User File for H36U12 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 */ /* (H36U12.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 H36U12.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\H36U12.DO */ /* The program below will output the Stata dataset H36U12.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H36U12.log, replace; clear; * INPUT ALL VARIABLES; infix long DUID 1-5 int PID 6-8 str DUPERSID 9-16 byte PANEL 17-18 byte INH12 19-19 byte INH20 20-20 byte INH28 21-21 byte INH38 22-22 byte INH50 23-23 byte INH60 24-24 byte INH70 25-25 byte INH79 26-26 byte INH89 27-27 byte INH97 28-28 byte INH105 29-29 byte INH113 30-30 byte INH121 31-31 byte INH129 32-32 byte INH138 33-33 byte INH147 34-34 byte INH155 35-35 int STRA9612 36-39 byte PSU9612 40-40 using H36U12.dat; *DEFINE VARIABLE LABELS; label variable DUID "DWELLING UNIT ID"; label variable PID "PERSON NUMBER"; label variable DUPERSID "PERSON ID (DUID + PID)"; label variable PANEL "PANEL NUMBER"; label variable INH12 "IN H12 POPULATION"; label variable INH20 "IN H20 POPULATION"; label variable INH28 "IN H28 POPULATION"; label variable INH38 "IN H38 POPULATION"; label variable INH50 "IN H50 POPULATION"; label variable INH60 "IN H60 POPULATION"; label variable INH70 "IN H70 POPULATION"; label variable INH79 "IN H79 POPULATION"; label variable INH89 "IN H89 POPULATION"; label variable INH97 "IN H97 POPULATION"; label variable INH105 "IN H105 POPULATION"; label variable INH113 "IN H113 POPULATION"; label variable INH121 "IN H121 POPULATION"; label variable INH129 "IN H129 POPULATION"; label variable INH138 "IN H138 POPULATION"; label variable INH147 "IN H147 POPULATION"; label variable INH155 "IN H155 POPULATION"; label variable STRA9612 "COMBINED VARIANCE STRATUM: 1996-2012"; label variable PSU9612 "COMBINED VARIANCE PSU: 1996-2012"; *DEFINE VALUE LABELS FOR REPORTS; label define H36U120001X 1 "1 YES" 2 "2 NO" ; label define H36U120002X 1 "1 YES" 2 "2 NO" ; label define H36U120003X 1 "1 YES" 2 "2 NO" ; label define H36U120004X 1 "1 YES" 2 "2 NO" ; label define H36U120005X 1 "1 YES" 2 "2 NO" ; label define H36U120006X 1 "1 YES" 2 "2 NO" ; label define H36U120007X 1 "1 YES" 2 "2 NO" ; label define H36U120008X 1 "1 YES" 2 "2 NO" ; label define H36U120009X 1 "1 YES" 2 "2 NO" ; label define H36U120010X 1 "1 YES" 2 "2 NO" ; label define H36U120011X 1 "1 YES" 2 "2 NO" ; label define H36U120012X 1 "1 YES" 2 "2 NO" ; label define H36U120013X 1 "1 YES" 2 "2 NO" ; label define H36U120014X 1 "1 YES" 2 "2 NO" ; label define H36U120015X 1 "1 YES" 2 "2 NO" ; label define H36U120016X 1 "1 YES" 2 "2 NO" ; label define H36U120017X 1 "1 YES" 2 "2 NO" ; label define H36U120018X 1 "1 PANEL 1" 10 "10 PANEL 10" 11 "11 PANEL 11" 12 "12 PANEL 12" 13 "13 PANEL 13" 14 "14 PANEL 14" 15 "15 PANEL 15" 16 "16 PANEL 16" 17 "17 PANEL 17" 18 "18 PANEL 18" 19 "19 PANEL 19" 2 "2 PANEL 2" 20 "20 PANEL 20" 3 "3 PANEL 3" 4 "4 PANEL 4" 5 "5 PANEL 5" 6 "6 PANEL 6" 7 "7 PANEL 7" 8 "8 PANEL 8" 9 "9 PANEL 9" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value INH105 H36U120001X; label value INH113 H36U120002X; label value INH12 H36U120003X; label value INH121 H36U120004X; label value INH129 H36U120005X; label value INH138 H36U120006X; label value INH147 H36U120007X; label value INH155 H36U120008X; label value INH20 H36U120009X; label value INH28 H36U120010X; label value INH38 H36U120011X; label value INH50 H36U120012X; label value INH60 H36U120013X; label value INH70 H36U120014X; label value INH79 H36U120015X; label value INH89 H36U120016X; label value INH97 H36U120017X; label value PANEL H36U120018X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H36U12, replace; #delimit cr * data file is stored in H36U12.dta * log file is stored in H36U12.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 H36U12.LOG and a data file named H36U12.DTA. If these files (H36U12.DTA and H36U12.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. ************************************************************************************************/