log using chlddisb.log, replace version 6.0 * THE FOLLOWING COMMAND TEMPORARILY CHANGES THE COMMAND- * ENDING DELIMITER FROM A CARRIAGE RETURN TO A SEMICOLON #delimit ; ********************************************************************* APRIL 17, 2012 3:26 PM THIS IS AN EXAMPLE OF A STATA DO PROGRAM THAT CREATES A STATA FILE FROM THE 2011 NHIS Public Use Child Disability Questions Test ASCII FILE NOTES: EXECUTING THIS PROGRAM WILL REPLACE chlddisb.dta AND chlddisb.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:\nhis2011\ 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 chlddisb.do *********************************************************************; clear; set mem 200m; * INPUT ALL VARIABLES; infix rectype 1 - 2 srvy_yr 3 - 6 str hhx 7 - 12 intv_qrt 13 - 13 intv_mon 14 - 15 str fmx 16 - 17 str fpx 18 - 19 wtfa_cdb 20 - 25 strat_p 26 - 28 psu_p 29 - 30 fdrn_flg 31 - 31 p2dchear 32 - 32 p2dcsee 33 - 33 p2dccon 34 - 34 p2dcwalk 35 - 35 p2dcdres 36 - 36 p2dcerr 37 - 37 using chlddisb.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 Number"; label variable intv_qrt "IDN.000_25.000: Interview Quarter"; label variable intv_mon "IDN.000_30.000: Interview Month"; label variable fmx "IDN.000_35.000: Family Number"; label variable fpx "IDN.000_40.000: Person Number (Within family)"; label variable wtfa_cdb " IDN.000_70.000: Weight - Final Annual Child Disability Questions Test file"; 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 "FDB.001_00.000: Disability Questions Test flag"; label variable p2dchear " CDB.020_00.000: Is--deaf or have serious difficulty hearing?"; label variable p2dcsee " CDB.040_00.000: Is--blind or have serious difficulty seeing even when wearing gl asses?"; label variable p2dccon " CDB.060_00.000: Does--have serious difficulty concentrating, remembering, or mak ing decisions?"; label variable p2dcwalk " CDB.080_00.000: Does--have serious difficulty walking or climbing stairs?"; label variable p2dcdres " CDB.100_00.000: Does--have difficulty dressing or bathing?"; label variable p2dcerr "CDB.120_00.000: Does--have difficulty doing errands?"; * DEFINE VALUE LABELS FOR REPORTS; label define cdp001x 10 "10 Household" 20 "20 Person" 25 "25 Income Imputation" 30 "30 Sample Adult" 31 "31 Sample Adult Cancer" 38 "38 Functioning and Disability" 39 "39 Adult Disability Questions Test" 40 "40 Sample Child" 49 "49 Child Disability Questions Test" 60 "60 Family" 63 "63 Family Disability Questions Test" 65 "65 Paradata" 70 "70 Injury/Poisoning Episode" 75 "75 Injury/Poisoning Verbatim" ; label define cdp004x 1 "1 Quarter 1" 2 "2 Quarter 2" 3 "3 Quarter 3" 4 "4 Quarter 4" ; label define cdp005x 01 "01 January" 02 "02 February" 03 "03 March" 04 "04 April" 05 "05 May" 06 "06 June" 07 "07 July" 08 "08 August" 09 "09 September" 10 "10 October" 11 "11 November" 12 "12 December" ; label define cdp011x 1 " 1 Families selected to receive ADB (sample adults) and CDB (sample children 1-17 years) sections" 2 " 2 Families selected to receive FDB (all persons 1 year and older) and AFD (sampl e adults) sections" ; label define cdp012x 1 "1 Yes" 2 "2 No" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label values rectype cdp001x; label values intv_qrt cdp004x; label values intv_mon cdp005x; label values fdrn_flg cdp011x; label values p2dchear cdp012x; label values p2dcsee cdp012x; label values p2dccon cdp012x; label values p2dcwalk cdp012x; label values p2dcdres cdp012x; label values p2dcerr cdp012x; * DISPLAY OVERALL DESCRIPTION OF FILE; describe; * DISPLAY A TEST TABLE FROM THE FILE; tabulate rectype [fweight= wtfa_cdb]; save chlddisb, replace; #delimit cr * data file is stored in chlddisb.dta * log file is stored in chlddisb.log log close