******************************************************************************* * File HALCyon cognitive syntax_Caerphilly.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 Caerphilly Prospective Study * Date Created 07/04/2010 * Date Modified 27/06/2011 * 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_Caerphilly.do /*Creating break between newly recoded cognitive variables and variables in existing dataset with a blank variable */ gen cogrecodes_below=. ; /*********************************************************************************/ /*Crystallized cognitive ability*/ /*nart*/ /* range 0-50*/ mvdecode c3cq73ascorecorrectpronounce c4cq73ascorecorrectpronounce, mv(99); gen nart_w3= c3cq73ascorecorrectpronounce ; label variable nart_w3 "NART at wave 3" ; gen nart_w4= c4cq73ascorecorrectpronounce ; label variable nart_w4 "NART at wave 4" ; gen nart_w5=c5_nart ; label variable nart_w5 "NART at wave 5" ; /*standardise NART to whole sample*/ egen nartz_w3=std(nart_w3) ; label variable nartz_w3 "standardised NART at wave 3" ; egen nartz_w4=std(nart_w4) ; label variable nartz_w4 "standardised NART at wave 4" ; egen nartz_w5=std(nart_w5) ; label variable nartz_w5 "standardised NART at wave 5" ; /*age-standardised NART - standardised residuals from regression on age*/ xi: regress nart_w3 age_w3; predict nartzage_w3, rstandard ; label variable nartzage_w3 "age-standardised NART at wave 3" ; xi: regress nart_w4 age_w4 ; predict nartzage_w4, rstandard ; label variable nartzage_w4 "age-standardised NART at wave 4" ; xi: regress nart_w5 age_w5 ; predict nartzage_w5, rstandard ; label variable nartzage_w5 "age-standardised NART at wave 5" ; /*reaction time*/ gen crt_w3=c3crt ; label variable crt_w3 "Reaction time at wave 3" ; gen crt_w4=c4crt ; label variable crt_w4 "Reaction time at wave 4" ; gen crt_w5=c5crt ; label variable crt_w5 "Reaction time at wave 5" ; gen lncrt_w3=ln(crt_w3) ; gen lncrt_w4=ln(crt_w4) ; gen lncrt_w5=ln(crt_w5) ; /*standardise ln(reaction time)*/ egen lncrtz_w3=std(lncrt_w3) ; label variable lncrtz_w3 "standardised ln(reaction time) at wave 3" ; egen lncrtz_w4=std(lncrt_w4) ; label variable lncrtz_w4 "standardised ln(reaction time) at wave 4" ; egen lncrtz_w5=std(lncrt_w5) ; label variable lncrtz_w5 "standardised ln(reaction time) at wave 5" ; /*age-standardised ln(reaction time) - standardised residuals from regression on age*/ xi: regress lncrt_w3 age_w3 ; predict lncrtzage_w3, rstandard ; label variable lncrtzage_w3 "age-standardised ln(reaction time) at wave 3" ; xi: regress lncrt_w4 age_w4 ; predict lncrtzage_w4, rstandard ; label variable lncrtzage_w4 "age-standardised ln(reaction time) at wave 4" ; xi: regress lncrt_w5 age_w5 ; predict lncrtzage_w5, rstandard ; label variable lncrtzage_w5 "age-standardised ln(reaction time) at wave 5" ; /*ah4*/ /*range 0-61*/ gen ah4_w3=c3ah4 ; label variable ah4_w3 "AH4 at wave 3" ; gen ah4_w4=c4ah4 ; label variable ah4_w4 "AH4 at wave 4" ; gen ah4_w5=c5ah4 ; label variable ah4_w5 "AH4 at wave 5" ; /*standardise AH4*/ egen ah4z_w3=std(ah4_w3) ; label variable ah4z_w3 "standardised AH4 at wave 3" ; egen ah4z_w4=std(ah4_w4) ; label variable ah4z_w4 "standardised AH4 at wave 4" ; egen ah4z_w5=std(ah4_w5) ; label variable ah4z_w5 "standardised AH4 at wave 5" ; /*age-standardised AH4 - standardised residuals from regression on age*/ xi: regress ah4_w3 age_w3 ; predict ah4zage_w3, rstandard ; label variable ah4zage_w3 "age-standardised AH4 at wave 3" ; xi: regress ah4_w4 age_w4 ; predict ah4zage_w4, rstandard ; label variable ah4zage_w4 "age-standardised AH4 at wave 4" ; xi: regress ah4_w5 age_w5 ; predict ah4zage_w5, rstandard ; label variable ah4zage_w5 "age-standardised AH4 at wave 5" ; /*derive fluid cognitive performance variable - Gf*/ factor ah4z_w3 lncrtz_w3, factors(1) pcf ; predict Gf_w3 ; label variable Gf_w3 "Gf at wave 3" ; factor ah4z_w4 lncrtz_w4, factors(1) pcf ; predict Gf_w4 ; label variable Gf_w4 "Gf at wave 4" ; factor ah4z_w5 lncrtz_w5, factors(1) pcf ; predict Gf_w5 ; label variable Gf_w5 "Gf at wave 5" ; /*age-standardised scores*/ factor ah4zage_w3 lncrtzage_w3, factors(1) pcf ; predict Gfage_w3 ; label variable Gfage_w3 "Gf (age adjusted) at wave 3" ; factor ah4zage_w4 lncrtzage_w4, factors(1) pcf ; predict Gfage_w4 ; label variable Gfage_w4 "Gf (age adjusted) at wave 4" ; factor ah4zage_w5 lncrtzage_w5, factors(1) pcf ; predict Gfage_w5 ; label variable Gfage_w5 "Gf (age adjusted) at wave 5" ; /*other cognitive tests*/ /*MMSE*/ gen mmse_w3=c3mmseindex ; label variable mmse_w3 "MMSE at wave 3" ; gen mmse_w4=c4mmseindex ; label variable mmse_w4 "MMSE at wave 4" ; gen mmse_w5=c5_mmse ; label variable mmse_w5 "MMSE at wave 5" ;