log using funcdisb.log, replace version 6.0 * THE FOLLOWING COMMAND TEMPORARILY CHANGES THE COMMAND- * ENDING DELIMITER FROM A CARRIAGE RETURN TO A SEMICOLON #delimit ; ********************************************************************* APRIL 5, 2013 2:18 PM THIS IS AN EXAMPLE OF A STATA DO PROGRAM THAT CREATES A STATA FILE FROM THE 2012 NHIS Public Use Functioning and Disability ASCII FILE NOTES: EXECUTING THIS PROGRAM WILL REPLACE funcdisb.dta AND funcdisb.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:\nhis2012\ 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 funcdisb.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_afd 20 - 25 strat_p 26 - 28 psu_p 29 - 30 fdrn_flg 31 - 31 afd_flg 32 - 32 vis_0 33 - 33 vis_ss2 34 - 34 hear_1r 35 - 35 hear_2r 36 - 36 hear_ss2 37 - 37 hear_3 38 - 38 hear_4 39 - 39 mob_ss2 40 - 40 mob_2r 41 - 41 mob_3a 42 - 42 mob_3b2 43 - 43 mob_3c 44 - 44 mob_3d2 45 - 45 mob_3e2 46 - 46 mob_3f 47 - 47 mob_3g 48 - 48 mob_4 49 - 49 mob_5 50 - 50 mob_6 51 - 51 mob_7 52 - 52 mob_8 53 - 53 com_ss 54 - 54 com_2 55 - 55 cog_ss 56 - 56 cog_1 57 - 57 cog_2 58 - 58 cog_3 59 - 59 ub_ss 60 - 60 ub_1 61 - 61 ub_2 62 - 62 anx_1 63 - 63 anx_2 64 - 64 anx_3r 65 - 65 dep_1 66 - 66 dep_2 67 - 67 dep_3r 68 - 68 pain_2 69 - 69 pain_4 70 - 70 tired_1 71 - 71 tired_2 72 - 72 tired_3 73 - 73 rcs_afd 74 - 74 using funcdisb.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_afd " IDN.000_70.000: Weight - Final Annual Functioning and Disability 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 afd_flg "FRT.002_00.000: Adult Functioning and Disability flag"; label variable vis_0 "AFD.090_00.000: Does respondent wear glasses?"; label variable vis_ss2 "AFD.100_00.000: Degree of difficulty seeing"; label variable hear_1r "AFD.140_00.000: Do you use a hearing aid?"; label variable hear_2r "AFD.145_00.000: How often do you use a hearing aid?"; label variable hear_ss2 "AFD.150_00.000: Degree of difficulty hearing"; label variable hear_3 " AFD.170_00.000: Degree of difficulty hearing conversation with one person in qui et room"; label variable hear_4 " AFD.170_00.001: Degree of difficulty hearing conversation with one person in noi sier room even when wearing hearing aid"; label variable mob_ss2 " AFD.180_00.000: Degree of difficulty walking or climbing steps"; label variable mob_2r " AFD.200_00.000: Use equipment or receive help for getting around?"; label variable mob_3a "AFD.200_00.001: Use cane or walking stick?"; label variable mob_3b2 "AFD.200_00.002: Use a walker or Zimmer frame?"; label variable mob_3c "AFD.200_00.003: Use crutches?"; label variable mob_3d2 "AFD.200_00.004: Use a wheelchair or scooter?"; label variable mob_3e2 "AFD.200_00.005: Use artificial limb (leg/foot)?"; label variable mob_3f "AFD.200_00.006: Use someone's assistance?"; label variable mob_3g "AFD.200_00.007: Use other type of equipment or help?"; label variable mob_4 " AFD.210_00.000: Degree of difficulty walking 100 yards on level ground without t he use of aid or equipment"; label variable mob_5 " AFD.220_00.000: Degree of difficulty walking a third of a mile on level ground w ithout the use of aid or equipment"; label variable mob_6 " AFD.230_00.000: Degree of difficulty walking up or down 12 steps without the use of aid or equipment"; label variable mob_7 " AFD.240_00.000: Degree of difficulty walking 100 yards on level ground when usin g aid or equipment"; label variable mob_8 " AFD.250_00.000: Degree of difficulty walking a third of a mile on level ground w hen using aid or equipment"; label variable com_ss " AFD.270_00.000: Degree of difficulty communicating using usual language"; label variable com_2 "AFD.290_00.000: Use sign language?"; label variable cog_ss " AFD.300_00.000: Degree of difficulty remembering or concentrating"; label variable cog_1 " AFD.310_00.000: Difficulty remembering, concentrating, or both?"; label variable cog_2 "AFD.320_00.000: How often have difficulty remembering? "; label variable cog_3 " AFD.330_00.000: Amount of things you have difficulty remembering?"; label variable ub_ss "AFD.360_00.000: Degree of difficulty with self-care"; label variable ub_1 " AFD.370_00.000: Degree of difficulty raising 2 liter bottle of water or soda fro m waist to eye level"; label variable ub_2 " AFD.380_00.000: Degree of difficulty using hands and fingers"; label variable anx_1 " AFD.410_00.000: How often feel worried, nervous, or anxious?"; label variable anx_2 " AFD.420_00.000: Take medication for worried, nervous, or anxious feelings?"; label variable anx_3r " AFD.430_00.000: Level of feelings when you last felt worried, nervous, or anxiou s?"; label variable dep_1 "AFD.450_00.000: How often do you feel depressed?"; label variable dep_2 "AFD.460_00.000: Take medication for depression?"; label variable dep_3r " AFD.470_00.000: How depressed you felt last time you were depressed?"; label variable pain_2 "AFD.500_00.000: Frequency of pain in past 3 months"; label variable pain_4 " AFD.520_00.000: How much pain you had last time you had pain?"; label variable tired_1 " AFD.540_00.000: How often felt very tired or exhausted in past 3 months"; label variable tired_2 " AFD.550_00.000: How long most recent tired or exhausted feelings lasted?"; label variable tired_3 " AFD.560_00.000: Level of tiredness last time felt very tired or exhausted"; label variable rcs_afd "AFD.000_00.000: Record completion status"; * DEFINE VALUE LABELS FOR REPORTS; label define afp001x 10 "10 Household" 20 "20 Person" 25 "25 Income Imputation" 30 "30 Sample Adult" 31 "31 Sample Adult Cancer" 34 "34 Adult Alternative Medicine" 38 "38 Functioning and Disability" 39 "39 Adult Disability Questions Test" 40 "40 Sample Child" 44 "44 Child Alternative Medicine" 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 afp004x 1 "1 Quarter 1" 2 "2 Quarter 2" 3 "3 Quarter 3" 4 "4 Quarter 4" ; label define afp005x 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 afp011x 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) sections" ; label define afp012x 1 "1 Sample Adult selected to receive AFD section" 2 "2 Sample Adult not selected to receive AFD section" ; label define afp013x 1 "1 Yes" 2 "2 No" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp014x 1 "1 No difficulty" 2 "2 Some difficulty" 3 "3 A lot of difficulty" 4 "4 Cannot do at all/unable to do" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp016x 1 "1 All of the time" 2 "2 Some of the time" 3 "3 Rarely" 4 "4 Never" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp037x 1 "1 Difficulty remembering only" 2 "2 Difficulty concentrating only" 3 "3 Difficulty with both remembering and concentrating" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp038x 1 "1 Sometimes" 2 "2 Often" 3 "3 All of the time" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp039x 1 "1 A few things" 2 "2 A lot of things" 3 "3 Almost everything" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp043x 1 "1 Daily" 2 "2 Weekly" 3 "3 Monthly" 4 "4 A few times a year" 5 "5 Never" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp045x 1 "1 A little" 2 "2 A lot" 3 "3 Somewhere in between a little and a lot" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp049x 1 "1 Never" 2 "2 Some days" 3 "3 Most days" 4 "4 Every day" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp052x 1 "1 Some of the day" 2 "2 Most of the day" 3 "3 All of the day" 7 "7 Refused" 8 "8 Not ascertained" 9 "9 Don't know" ; label define afp054x 1 "1 Not ascertained answers only" 2 "2 Refused and don't know answers only" 3 "3 Refused, DK, and not ascertained answers only" 4 "4 At least one valid answer" ; * ASSOCIATE VARIABLES WITH VALUE LABEL DEFINITIONS; label values rectype afp001x; label values intv_qrt afp004x; label values intv_mon afp005x; label values fdrn_flg afp011x; label values afd_flg afp012x; label values vis_0 afp013x; label values vis_ss2 afp014x; label values hear_1r afp013x; label values hear_2r afp016x; label values hear_ss2 afp014x; label values hear_3 afp014x; label values hear_4 afp014x; label values mob_ss2 afp014x; label values mob_2r afp013x; label values mob_3a afp013x; label values mob_3b2 afp013x; label values mob_3c afp013x; label values mob_3d2 afp013x; label values mob_3e2 afp013x; label values mob_3f afp013x; label values mob_3g afp013x; label values mob_4 afp014x; label values mob_5 afp014x; label values mob_6 afp014x; label values mob_7 afp014x; label values mob_8 afp014x; label values com_ss afp014x; label values com_2 afp013x; label values cog_ss afp014x; label values cog_1 afp037x; label values cog_2 afp038x; label values cog_3 afp039x; label values ub_ss afp014x; label values ub_1 afp014x; label values ub_2 afp014x; label values anx_1 afp043x; label values anx_2 afp013x; label values anx_3r afp045x; label values dep_1 afp043x; label values dep_2 afp013x; label values dep_3r afp045x; label values pain_2 afp049x; label values pain_4 afp045x; label values tired_1 afp049x; label values tired_2 afp052x; label values tired_3 afp045x; label values rcs_afd afp054x; * DISPLAY OVERALL DESCRIPTION OF FILE; describe; * DISPLAY A TEST TABLE FROM THE FILE; tabulate rectype [fweight= wtfa_afd]; save funcdisb, replace; #delimit cr * data file is stored in funcdisb.dta * log file is stored in funcdisb.log log close