******************************************************************************* * File HALCyon cognitive syntax_HAS.do * BY       Rebecca Hardy, MRC Unit for Lifelong Health and Ageing at UCL * FOR     HALCyon cross-cohort collaboration (funded by the New Dynamics of Ageing (RES-353-25-0001)) * DATASET Hertfordshire Ageing Study (HAS) * Date Created 07/04/2010 * PURPOSE Recodes and derives cognitive variables for use in cross-cohort analyses ******************************************************************************* # delimit; set more off; *To obtain age variables, please first run HALCyon PC covariate syntax_HAS.do /*Creating break between newly recoded cognitive variables and variables in existing dataset with a blank variable */ gen cogrecodes_below=. ; /*********************************************************************************/ /*Crystallized cognitive ability*/ /*Mill Hill vocabulary*/ /*range 0-35*/ gen mh_w1=numcorr9 ; label variable mh_w1 "Mill Hill at wave 1" ; gen mh_w2=mhncorr ; label variable mh_w2 "Mill Hill at wave 2" ; /*standardised Mill Hill score to whole sample*/ egen mhz_w1=std(mh_w1) ; egen mhz_w2=std(mh_w2) ; label variable mhz_w1 "standardised Mill Hill at wave 1" ; label variable mhz_w2 "standardised Mill Hill at wave 2" ; /*standardise Mill Hill for men and women seprately*/ egen mhzm_w1=std(mh_w1) if sex==1; egen mhzf_w1=std(mh_w1) if sex==2; label variable mhzm_w1 "standardised Mill Hill for men at wave 1" ; label variable mhzf_w1 "standardised Mill Hill for women at wave 1" ; egen mhzm_w2=std(mh_w2) if sex==1; egen mhzf_w2=std(mh_w2) if sex==2; label variable mhzm_w2 "standardised Mill Hill for men at wave 2" ; label variable mhzf_w2 "standardised Mill Hill for women at wave 2" ; /*combine in one variable*/ gen mhzs_w1=. ; replace mhzs_w1=mhzm_w1 if sex==1; replace mhzs_w1=mhzf_w1 if sex==2; label variable mhzs_w1 "sex-standardised Mill Hill at wave 1" ; gen mhzs_w2=. ; replace mhzs_w2=mhzm_w2 if sex==1; replace mhzs_w2=mhzf_w2 if sex==2; label variable mhzs_w2 "sex-standardised Mill Hill at wave 2" ; /*age and sex-standardised Mill Hill - standardised residuals from regression on age and sex*/ xi: regress mh_w1 age_w1 i.sex ; predict mhzage_w1, rstandard ; label variable mhzage_w1 "age and sex-standardised Mill Hill at wave 1" ; xi: regress mh_w2 age_w2 i.sex ; predict mhzage_w2, rstandard ; label variable mhzage_w2 "age and sex-standardised Mill Hill at wave 2" ; /*AH4*/ /*range 0-50*/ gen ah4_w1=numcorr ; label variable ah4_w1 "AH4 at wave 1" ; gen ah4_w2=hnumcorr ; label variable ah4_w2 "AH4 at wave 2" ; /*Gf includes only AH4*/ /*standadised AH4*/ egen ah4z_w1=std(ah4_w1); egen ah4z_w2=std(ah4_w2); label variable ah4z_w1 "standardised AH4 at wave 1 (Gf)" ; label variable ah4z_w2 "standardised AH4 at wave 2 (Gf)" ; /*standardise AH4 for men and women seprately*/ egen ah4zm_w1=std(ah4_w1) if sex==1; egen ah4zf_w1=std(ah4_w1) if sex==2; label variable ah4zm_w1 "standardised AH4 for men at wave 1 (Gf)" ; label variable ah4zf_w1 "standardised AH4 for women at wave 1 (Gf)" ; egen ah4zm_w2=std(ah4_w2) if sex==1; egen ah4zf_w2=std(ah4_w2) if sex==2; label variable mhzm_w2 "standardised AH4 for men at wave 2 (Gf)" ; label variable mhzf_w2 "standardised AH4 for women at wave 2 (Gf)" ; /*combine in one variable*/ gen ah4zs_w1=. ; replace ah4zs_w1=ah4zm_w1 if sex==1; replace ah4zs_w1=ah4zf_w1 if sex==2; label variable ah4zs_w1 "sex-standardised AH4 at wave 1 (Gf)" ; gen ah4zs_w2=. ; replace ah4zs_w2=ah4zm_w2 if sex==1; replace ah4zs_w2=ah4zf_w2 if sex==2; label variable ah4zs_w2 "sex-standardised AH4 at wave 2 (Gf)" ; /*age and sex-standardised AH4 - standardised residuals from regression on age and sex*/ xi: regress ah4_w1 age_w1 i.sex ; predict ah4zage_w1, rstandard ; label variable ah4zage_w1 "age and sex-standardised AH4 at wave 1 (Gf)" ; xi: regress ah4_w2 age_w2 i.sex ; predict ah4zage_w2, rstandard ; label variable ah4zage_w2 "age and sex-standardised AH4 at wave 2 (Gf)" ; /*MMSE*/ gen mmse_w2=mmtotsc label variable mmse_w2 "MMSE total score at wave 2" /*AMT*/ gen amt_w1=amtotsc label variable amt_w1 "AMT at wave 1"