/************************************************************************************************/ /* Stata User File for H240 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 */ /* (H240.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 H240.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\H240.DO */ /* The program below will output the Stata dataset H240.DTA */ /************************************************************************************************/ #delimit ; cd C:\MEPS\DATA; log using H240.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-53 int VARSTR 54-57 byte VARPSU 58-58 using H240.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 - 2022"; label variable VARPSU "VARIANCE ESTIMATION PSU - 2022"; *DEFINE VALUE LABELS FOR REPORTS; label define H2400001X -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 H2400002X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2400003X -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 H2400004X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2400005X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2400006X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" ; label define H2400007X -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 H2400008X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" ; label define H2400009X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2400010X -1 "-1 INAPPLICABLE" -15 "-15 CANNOT BE COMPUTED" -7 "-7 REFUSED" -8 "-8 DK" 1 "1 YES" 2 "2 NO" ; label define H2400011X 24 "PANEL 24" 26 "PANEL 26" 27 "PANEL 27" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label value FSAFRD42 H2400001X; label value FSHGRY42 H2400002X; label value FSLAST42 H2400003X; label value FSLESS42 H2400004X; label value FSNEAT42 H2400005X; label value FSNEDY42 H2400006X; label value FSOUT42 H2400007X; label value FSSKDY42 H2400008X; label value FSSKIP42 H2400009X; label value FSWTLS42 H2400010X; label value PANEL H2400011X; *DISPLAY A DESCRIPTION OF STATA FILE; describe; *LIST FIRST 20 OBSERVATIONS IN THE FILE; list in 1/20; save H240, replace; #delimit cr * data file is stored in H240.dta * log file is stored in H240.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 H240.LOG and a data file named H240.DTA. If these files (H240.DTA and H240.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. ************************************************************************************************/