/************************************************************************************************/ /* Stata User File for H221 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 */ /* (H221.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 H221.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\H221.DO */ /* The program below will output the Stata dataset H221.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H221.log, replace; clear; * INPUT ALL VARIABLES; infix str HOMEIDX 1-9 long DUID 10-16 byte PANEL 17-18 str RULETR42 19-20 byte FSOUT42 21-22 byte FSLAST42 23-24 byte FSAFRD42 25-26 byte FSSKIP42 27-28 byte FSSKDY42 29-30 byte FSLESS42 31-32 byte FSHGRY42 33-34 byte FSWTLS42 35-36 byte FSNEAT42 37-38 byte FSNEDY42 39-40 double FSWT42 41-52 int VARSTR 53-56 byte VARPSU 57-57 using H221.dat; *DEFINE VARIABLE LABELS; label variable HOMEIDX "HOME ID NUMBER (DUID + RU + ROUND)"; label variable DUID "PANEL # + ENCRYPTED DU IDENTIFIER"; label variable PANEL "PANEL NUMBER"; label variable RULETR42 "RU LETTER - R4/2"; 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 COULDN T 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 - 2020"; label variable VARPSU "VARIANCE ESTIMATION PSU - 2020"; *DEFINE VALUE LABELS FOR REPORTS; label define H2210001X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 OFTEN TRUE" 2 "2 SOMETIMES TRUE" 3 "3 NEVER TRUE" ; label define H2210002X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2210003X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 OFTEN TRUE" 2 "2 SOMETIMES TRUE" 3 "3 NEVER TRUE" ; label define H2210004X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2210005X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2210006X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" ; label define H2210007X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 OFTEN TRUE" 2 "2 SOMETIMES TRUE" 3 "3 NEVER TRUE" ; label define H2210008X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" ; label define H2210009X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2210010X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2210011X 23 "PANEL 23" 24 "PANEL 24" 25 "PANEL 25" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value FSAFRD42 H2210001X; label value FSHGRY42 H2210002X; label value FSLAST42 H2210003X; label value FSLESS42 H2210004X; label value FSNEAT42 H2210005X; label value FSNEDY42 H2210006X; label value FSOUT42 H2210007X; label value FSSKDY42 H2210008X; label value FSSKIP42 H2210009X; label value FSWTLS42 H2210010X; label value PANEL H2210011X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H221, replace; #delimit cr * data file is stored in H221.dta * log file is stored in H221.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 H221.LOG and a data file named H221.DTA. If these files (H221.DTA and H221.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. ************************************************************************************************/