/************************************************************************************************/ /* Stata User File for H189 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 */ /* (H189.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 H189.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\H189.DO */ /* The program below will output the Stata dataset H189.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H189.log, replace; clear; * INPUT ALL VARIABLES; infix str HOMEIDX 1-7 str DUID 8-12 str PANEL 13-14 byte FSOUT42 15-16 byte FSLAST42 17-18 byte FSAFRD42 19-20 byte FSSKIP42 21-22 byte FSSKDY42 23-24 byte FSLESS42 25-26 byte FSHGRY42 27-28 byte FSWTLS42 29-30 byte FSNEAT42 31-32 byte FSNEDY42 33-34 double FSWT42 35-46 int VARSTR 47-50 byte VARPSU 51-51 using H189.dat; *DEFINE VARIABLE LABELS; label variable HOMEIDX "HOME ID NUMBER (DUID + RU + ROUND)"; label variable DUID "DWELLING UNIT ID"; label variable PANEL "PANEL"; label variable FSOUT42 "HOW OFTEN HAVE YOU RUN OUT OF FOOD"; label variable FSLAST42 "HOW OFTEN DID FOOD NOT LAST"; label variable FSAFRD42 "HOW OFTEN NOT AFFORD BALANCED MEALS"; label variable FSSKIP42 "DID YOU EVER SKIP MEALS"; label variable FSSKDY42 "HOW MANY DAYS WERE MEALS SKIPPED"; label variable FSLESS42 "DID YOU EVER EAT LESS"; label variable FSHGRY42 "DID YOU EVER GO HUNGRY"; label variable FSWTLS42 "LOW FOOD MONEY CAUSE WEIGHT LOSS"; label variable FSNEAT42 "DID YOU EVER NOT EAT"; label variable FSNEDY42 "HOW MANY DAYS DID YOU NOT EAT"; label variable FSWT42 "FOOD SECURITY WEIGHT"; label variable VARSTR "VARIANCE ESTIMATION STRATUM - 2016"; label variable VARPSU "VARIANCE ESTIMATION PSU - 2016"; *DEFINE VALUE LABELS FOR REPORTS; label define H1890001X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 OFTEN TRUE" 2 "2 SOMETIMES TRUE" 3 "3 NEVER TRUE" ; label define H1890002X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 YES" 2 "2 NO" ; label define H1890003X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 OFTEN TRUE" 2 "2 SOMETIMES TRUE" 3 "3 NEVER TRUE" ; label define H1890004X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 YES" 2 "2 NO" ; label define H1890005X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 YES" 2 "2 NO" ; label define H1890006X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" ; label define H1890007X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 OFTEN TRUE" 2 "2 SOMETIMES TRUE" 3 "3 NEVER TRUE" ; label define H1890008X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" ; label define H1890009X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 YES" 2 "2 NO" ; label define H1890010X -1 "-1 INAPPLICABLE" -7 "-7 REFUSED" -8 "-8 DK" -9 "-9 NOT ASCERTAINED" 1 "1 YES" 2 "2 NO" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value FSAFRD42 H1890001X; label value FSHGRY42 H1890002X; label value FSLAST42 H1890003X; label value FSLESS42 H1890004X; label value FSNEAT42 H1890005X; label value FSNEDY42 H1890006X; label value FSOUT42 H1890007X; label value FSSKDY42 H1890008X; label value FSSKIP42 H1890009X; label value FSWTLS42 H1890010X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H189, replace; #delimit cr * data file is stored in H189.dta * log file is stored in H189.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 H189.LOG and a data file named H189.DTA. If these files (H189.DTA and H189.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. ************************************************************************************************/