// Creates w_scghq1_dv, w_scghq1_dv. // INPUT FILE - w_indresp.dta // OUTPUT FILE - w_scghq_dv.dta // WRITE FILEPATH WHERE YOU HAVE DOWNLOADED THE DATA global in "" // WRITE FILEPATH WHERE YOU WOULD LIKE TO SAVE THE OUTPUT FILE global outpath "" // 1 is for BHPS, 2 is for UKHLS global cohort "2" foreach w in a b c d e f g h i j k l { // INCLUDE WAVE LETTERS FOR THE WAVES NEEDED global wave "`w'_" global num=strpos("abcdefghijklmnopqrstuvwxyz","`w'") global dta "" global waveno=$num global inpath "${in}/bhps_w${num}" if $cohort==2 { global waveno=$num+18 global inpath "${in}/ukhls" } use "${inpath}/${wave}indresp${dta}", clear drop ${wave}scghq1_dv ${wave}scghq2_dv label drop ${wave}scghq1_dv ${wave}scghq2_dv /* This code derives the General health Questionaire (GHQ) Likert and caseness measures. The likert measures, $_GHQ1_DV converts valid answers to questions $_A3 to $_A14 to a single scale by recoding so that the scale for individual variables runs from 0 to 3 instead of 1 to 4, and then summing, giving a scale running from 0 (the least distressed) to 36 (the most distressed). See Cox, B.D et al, The Health and Lifestyle Survey (London: Health Promotion Research Trust, 1987). The caseness measure, $_GHQ2_DV, converts valid answers to questions $_A3 to $_A14 to a single scale by recoding 1 and 2 values on individual variables to 0, and 3 and 4 values to 1, and then summing, giving a scale running from 0 (the least distressed) to 12 (the most distressed). Reference as above. */ if ${cohort}==1 { rename ${wave}scghq1_dv ${wave}scghq1 cap lab drop ${wave}scghq1_dv rename ${wave}scghq2_dv ${wave}scghq2 cap lab drop ${wave}scghq2_dv } global vloop1 "${wave}scghqa ${wave}scghqb ${wave}scghqc ${wave}scghqd ${wave}scghqe ${wave}scghqf" global vloop2 "${wave}scghqg ${wave}scghqh ${wave}scghqi ${wave}scghqj ${wave}scghqk ${wave}scghql" global vloop "${vloop1} ${vloop2}" foreach var of global vloop { recode `var' -11 -10 -9/-1 = . gen `var'l=`var'-1 /*Likert Scoring*/ gen `var'c = `var' /*Caseness Scoring*/ recode `var'c 1/2 = 0 3/4 = 1 } // Likert Scoring gen ${wave}scghq1_dv = ${wave}scghqal+${wave}scghqbl+${wave}scghqcl+${wave}scghqdl+${wave}scghqel+${wave}scghqfl /// +${wave}scghqgl+${wave}scghqhl+${wave}scghqil+${wave}scghqjl+${wave}scghqkl+${wave}scghqll replace ${wave}scghq1_dv=-9 if ${wave}scghq1_dv==. recode ${wave}scghq1_dv (-9=-7) if ${wave}ivfio==2 lab def ${wave}scghq1_dv -9 "Missing" /// -8 "Inapplicable" /// -7 "Proxy respondent" /// -2 "Refusal" /// -1 "Don't know" lab val ${wave}scghq1_dv ${wave}scghq1_dv label variable ${wave}scghq1_dv "Subjective wellbeing (GHQ): Likert" // Caseness Scoring gen ${wave}scghq2_dv = ${wave}scghqac+${wave}scghqbc+${wave}scghqcc+${wave}scghqdc+${wave}scghqec+${wave}scghqfc /// +${wave}scghqgc+${wave}scghqhc+${wave}scghqic+${wave}scghqjc+${wave}scghqkc+${wave}scghqlc replace ${wave}scghq2_dv=-9 if ${wave}scghq2_dv==. recode ${wave}scghq2_dv (-9=-7) if ${wave}ivfio==2 lab def ${wave}scghq2_dv -9 "Missing" /// -8 "Inapplicable" /// -7 "Proxy respondent" /// -2 "Refusal" /// -1 "Don't know" lab val ${wave}scghq2_dv ${wave}scghq2_dv label variable ${wave}scghq2_dv "Subjective wellbeing (GHQ): Caseness" if ${waveno}==19 { capture gen SC1=(${wave}scflag_dv==0) } if ${cohort}==2 { for var ${wave}scghq*_dv: recode X (-9=-8) if ${wave}scflag_dv~=1 | inlist(${wave}scghqa,-10,-11) } sum ${wave}scghq1_dv ${wave}scghq2_dv drop ${wave}scghqal ${wave}scghqbl ${wave}scghqcl ${wave}scghqdl ${wave}scghqel ${wave}scghqfl ${wave}scghqgl /// ${wave}scghqhl ${wave}scghqil ${wave}scghqjl ${wave}scghqkl ${wave}scghqll ${wave}scghqac ${wave}scghqbc /// ${wave}scghqcc ${wave}scghqdc ${wave}scghqec ${wave}scghqfc ${wave}scghqgc ${wave}scghqhc ${wave}scghqic /// ${wave}scghqjc ${wave}scghqkc ${wave}scghqlc keep pidp ${wave}scghq1_dv ${wave}scghq2_dv save "$outpath/${wave}scghq_dv", replace }