log using disbtest.log, replace version 6.0 * THE FOLLOWING COMMAND TEMPORARILY CHANGES THE COMMAND- * ENDING DELIMITER FROM A CARRIAGE RETURN TO A SEMICOLON #delimit ; ********************************************************************* JUNE 3, 2010 11:09 AM THIS IS AN EXAMPLE OF A STATA DO PROGRAM THAT CREATES A STATA FILE FROM THE 2009 NHIS Public Use Disability Questions Tests 2008/2009 ASCII FILE NOTES: EXECUTING THIS PROGRAM WILL REPLACE disbtest.dta AND disbtest.log IF THOSE FILES ALREADY EXIST IN THE DEFAULT DIRECTORY THIS PROGRAM ASSUMES THAT THE ASCII DATA FILE IS IN THE STATA WORKING DIRECTORY. AN EXAMPLE OF HOW TO CHANGE THE WORKING DIRECTORY WITHIN STATA IS THE FOLLOWING COMMAND: cd C:\nhis2009\ THIS PROGRAM OPENS A LOG FILE. 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 THIS IS STORED IN disbtest.do *********************************************************************; clear; set mem 200m; * INPUT ALL VARIABLES; infix rectype 1 - 2 srvy_yr 3 - 6 str hhx 7 - 12 intv_qrt 13 - 13 assignwk 14 - 15 str fmx 16 - 17 str fpx 18 - 19 wt5q_dis 20 - 25 strat_p 26 - 28 psu_p 29 - 30 fdrn_flg 31 - 31 p1dfhear 32 - 32 p1dfsee 33 - 33 p1dfcon 34 - 34 p1dfwalk 35 - 35 p1dfdres 36 - 36 p1dferr 37 - 37 p2dfhear 38 - 38 p2dfsee 39 - 39 p2dfcon 40 - 40 p2dfwalk 41 - 41 p2dfdres 42 - 42 p2dferr 43 - 43 using disbtest.dat; * DEFINE VARIABLE LABELS; label variable rectype "IDN.000_00.000: File type identifier"; label variable srvy_yr " IDN.000_02.000: Year of National Health Interview Survey"; label variable hhx "IDN.000_04.000: Household Serial Number"; label variable intv_qrt "IDN.000_25.000: Interview Quarter"; label variable assignwk "IDN.000_30.000: Assignment Week"; label variable fmx "IDN.000_35.000: Family #"; label variable fpx "IDN.000_40.000: Person Number (Within family)"; label variable wt5q_dis " IDN.000_80.000: Weight - Five-quarter Disability Questions Tests file 2008/2009 "; label variable strat_p " UCF.000_00.000: Pseudo-stratum for public-use file variance estimation"; label variable psu_p " UCF.000_00.000: Pseudo-PSU for public-use file variance estimation"; label variable fdrn_flg "FDA.001_00.000: Question Version"; label variable p1dfhear " FDA.020_00.000: Is--deaf or have serious difficulty hearing?"; label variable p1dfsee " FDA.040_00.000: Is--blind or have serious difficulty seeing even when wearing gl asses?"; label variable p1dfcon " FDA.060_00.000: Does--have serious difficulty concentrating, remembering, or mak ing decisions?"; label variable p1dfwalk " FDA.080_00.000: Does--have serious difficulty walking or climbing stairs?"; label variable p1dfdres " FDA.100_00.000: Does--have difficulty dressing or bathing?"; label variable p1dferr "FDA.120_00.000: Does--have difficulty doing errands?"; label variable p2dfhear " FDB.020_00.000: Is--deaf or have serious difficulty hearing?"; label variable p2dfsee " FDB.040_00.000: Is--blind or have serious difficulty seeing even when wearing gl asses?"; label variable p2dfcon " FDB.060_00.000: Does--have serious difficulty concentrating, remembering, or mak ing decisions?"; label variable p2dfwalk " FDB.080_00.000: Does--have serious difficulty walking or climbing stairs?"; label variable p2dfdres " FDB.100_00.000: Does--have difficulty dressing or bathing?"; label variable p2dferr "FDB.120_00.000: Does--have difficulty doing errands?"; * DEFINE VALUE LABELS FOR REPORTS; label define dip001x 10 "10 Household" 20 "20 Person" 25 "25 Income Imputation" 30 "30 Sample Adult" 40 "40 Sample Child" 60 "60 Family" 63 "63 Disability Questions Tests 2008/2009" 65 "65 Paradata" 70 "70 Injury/Poisoning Episode" 75 "75 Injury/Poisoning Verbatim" ; label define dip004x 1 "1 Quarter 1" 2 "2 Quarter 2" 3 "3 Quarter 3" 4 "4 Quarter 4" ; label define dip005x 01 "01 Week 1" 02 "02 Week 2" 03 "03 Week 3" 04 "04 Week 4" 05 "05 Week 5" 06 "06 Week 6" 07 "07 Week 7" 08 "08 Week 8" 09 "09 Week 9" 10 "10 Week 10" 11 "11 Week 11" 12 "12 Week 12" 13 "13 Week 13" ; label define dip011x 1 "1 Family style (anyone/who is it) administration" 2 "2 Person-level administration" ; label define dip018x 1 "1 Yes" 2 "2 No" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define dip022x 1 "1 Yes" 2 "2 No" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don' know" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label values rectype dip001x; label values intv_qrt dip004x; label values assignwk dip005x; label values fdrn_flg dip011x; label values p2dfhear dip018x; label values p2dfsee dip018x; label values p2dfcon dip018x; label values p2dfwalk dip018x; label values p2dfdres dip022x; label values p2dferr dip018x; * DISPLAY OVERALL DESCRIPTION OF FILE; describe; * DISPLAY A TEST TABLE FROM THE FILE; tabulate rectype [fweight= wt5q_dis]; save disbtest, replace; #delimit cr * data file is stored in disbtest.dta * log file is stored in disbtest.log log close