log using fmlydisb.log, replace cd c:\nhis2017\ version 6.0 * THE FOLLOWING COMMAND TEMPORARILY CHANGES THE COMMAND- * ENDING DELIMITER FROM A CARRIAGE RETURN TO A SEMICOLON #delimit ; ********************************************************************* JUNE 15, 2018 10:15 AM THIS IS AN EXAMPLE OF A STATA DO PROGRAM THAT CREATES A STATA FILE FROM THE 2017 NHIS Public Use Family Disability Questions ASCII FILE NOTES: EXECUTING THIS PROGRAM WILL REPLACE fmlydisb.dta AND fmlydisb.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:\nhis2017\ 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 fmlydisb.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_fdb 20 - 25 pstrat 26 - 28 ppsu 29 - 31 fdrn_flg 32 - 32 p2dfhear 33 - 33 p2dfsee 34 - 34 p2dfcon 35 - 35 p2dfwalk 36 - 36 p2dfdres 37 - 37 p2dferr 38 - 38 pdfcaus2 39 - 40 using fmlydisb.dat; * DEFINE VARIABLE LABELS; label variable rectype "File type identifier"; label variable srvy_yr "Year of National Health Interview Survey"; label variable hhx "Household Number"; label variable intv_qrt "Interview Quarter"; label variable intv_mon "Assignment/Interview Month"; label variable fmx "Family Number"; label variable fpx "Person Number (Within family)"; label variable wtfa_fdb "Weight - Final Annual Family Disability Questions file "; label variable pstrat "Pseudo-stratum for public-use file variance estimation "; label variable ppsu "Pseudo-PSU for public-use file variance estimation"; label variable fdrn_flg "Disability Questions flag"; label variable p2dfhear "Serious difficulty hearing"; label variable p2dfsee "Serious difficulty seeing even when wearing glasses"; label variable p2dfcon " Serious diff making decisions bec of physical/mental /emotional cond"; label variable p2dfwalk "Serious difficulty walking or climbing stairs"; label variable p2dfdres "Difficulty dressing or bathing"; label variable p2dferr " Difficulty doing errands alone bec of physical/mental/emotional cond"; label variable pdfcaus2 " Main reason for difficulty concentrating, remembering, or making decisions"; * DEFINE VALUE LABELS FOR REPORTS; label define fdp001x 10 "10 Household" 20 "20 Person" 25 "25 Income Imputation" 30 "30 Sample Adult" 38 "38 Functioning and Disability" 40 "40 Sample Child" 60 "60 Family" 63 "63 Family Disability Questions" 65 "65 Paradata" 70 "70 Injury/Poisoning Episode" 75 "75 Injury/Poisoning Verbatim" ; label define fdp004x 1 "1 Quarter 1" 2 "2 Quarter 2" 3 "3 Quarter 3" 4 "4 Quarter 4" ; label define fdp005x 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 fdp011x 1 "1 Families selected to receive AFD (sample adults) section" 2 " 2 Families selected to receive FDB (all persons 1 year and older) section" ; label define fdp012x 1 "1 Yes" 2 "2 No" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define fdp018x 01 "01 Intellectual disability (formerly known as mental retardation)" 02 "02 Developmental disability (such as cerebral palsy or autism)" 03 "03 Dementia or Alzheimer’s disease" 04 "04 Learning disability or ADHD" 05 "05 Education level" 06 " 06 Mental illness (such as depression, anxiety, post-traumatic stress disorder, emotional problem)" 07 "07 Traumatic brain injury or stroke" 08 "08 Age-related changes" 09 " 09 Chronic health condition (e.g., diabetes, HBP, heart disease, cancer, multipl e sclerosis, Parkinson’s disease)" 10 "10 Drugs or medications" 11 "11 Other (specify)" 97 "97 Refused" 98 "98 Not ascertained" 99 "99 Don't know" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label values rectype fdp001x; label values intv_qrt fdp004x; label values intv_mon fdp005x; label values fdrn_flg fdp011x; label values p2dfhear fdp012x; label values p2dfsee fdp012x; label values p2dfcon fdp012x; label values p2dfwalk fdp012x; label values p2dfdres fdp012x; label values p2dferr fdp012x; label values pdfcaus2 fdp018x; * DISPLAY OVERALL DESCRIPTION OF FILE; describe; * DISPLAY A TEST TABLE FROM THE FILE; tabulate rectype [fweight= wtfa_fdb]; save fmlydisb, replace; #delimit cr * data file is stored in fmlydisb.dta * log file is stored in fmlydisb.log log close