******************************************************************************* * File HALCyon cognitive syntax_Aberdeen1936.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 Aberdeen Birth Cohort 1936 (ABC1936) * Date Created 07/04/2010 * PURPOSE Recodes and derives cognitive variables for use in cross-cohort analyses ******************************************************************************* #delimit ; set more off ; *To obtain age and sex variables, please first run HALCyon PC covariate syntax_Aberdeen1936.do /*Creating break between newly recoded cognitive variables and variables in existing dataset with a blank variable */ gen cogrecodes_below=. ; /*********************************************************************************/ /*need to generate age at waves 2 and 3 - already done for wave 1*/ gen double w2_date_st=dofC(w2_date); gen double w3_date_st=dofC(w3_date); label variable w2_date_st "Wave 2 collection date (stata format)" ; label variable w3_date_st "Wave 3 collection date (stata format)" ; /*Calculate age in days at wave 2/3 (subtracting dob_st as it is a negative number (because it is pre=1960)) */ gen aged_w2=w2_date_st-dob_st; gen aged_w3=w3_date_st-dob_st; /*dividing by 365 for estimation of age in years */ gen age_w2=aged_w2/365 ; gen age_w3=aged_w3/365 ; label variable aged_w2 "Age(in days) at wave 2" ; label variable age_w2 "Age(y) at wave 2" ; label variable aged_w3 "Age(in days) at wave 3" ; label variable age_w3 "Age(y) at wave 3" ; /*Crystalilized cognitive ability*/ /*NART*/ gen nart_w1=nartcor ; label variable nart_w1 "NART number correct at wave 1" ; gen nart_w2=ncor2 ; label variable nart_w2 "NART number correct at wave 2"; gen nart_w3=ncor3 ; label variable nart_w3 "NART number correct at wave 3" ; /*range 0-50 - delete scores above 50*/ /*note: there is also a score of 1 which you might want to exclude?*/ replace nart_w3=. if nart_w3>50 ; /*standardise NART to whole sample*/ egen nartz_w1=std(nart_w1); label variable nartz_w1 "standardised NART at wave 1" ; egen nartz_w2=std(nart_w2) ; label variable nartz_w2 "standardised NART at wave 2" ; egen nartz_w3=std(nart_w3) ; label variable nartz_w3 "standardised NART at wave 3" ; /*standardise NART for men and women seprately*/ egen nartzm_w1=std(nart_w1) if sex==1; egen nartzf_w1=std(nart_w1) if sex==2; label variable nartzm_w1 "standardised NART for men at wave 1" ; label variable nartzf_w1 "standardised NART for women at wave 1" ; egen nartzm_w2=std(nart_w2) if sex==1; egen nartzf_w2=std(nart_w2) if sex==2; label variable nartzm_w2 "standardised NART for men at wave 2" ; label variable nartzf_w2 "standardised NART for women at wave 2" ; egen nartzm_w3=std(nart_w3) if sex==1; egen nartzf_w3=std(nart_w3) if sex==2; label variable nartzm_w3 "standardised NART for men at wave 3" ; label variable nartzf_w3 "standardised NART for women at wave 3" ; /*combine in one variable*/ gen nartzs_w1=. ; replace nartzs_w1=nartzm_w1 if sex==1; replace nartzs_w1=nartzf_w1 if sex==2; label variable nartzs_w1 "sex-standardised NART at wave 1" ; gen nartzs_w2=. ; replace nartzs_w2=nartzm_w2 if sex==1; replace nartzs_w2=nartzf_w2 if sex==2; label variable nartzs_w2 "sex-standardised NART at wave 2" ; gen nartzs_w3=. ; replace nartzs_w3=nartzm_w3 if sex==1; replace nartzs_w3=nartzf_w3 if sex==2; label variable nartzs_w3 "sex-standardised NART at wave 3" ; /*age and sex-standardised NART - standardised residuals from regression on age and sex*/ xi: regress nart_w1 age_w1 i.sex ; predict nartzage_w1, rstandard ; label variable nartzage_w1 "age and sex-standardised NART at wave 1" ; xi: regress nart_w2 age_w2 i.sex ; predict nartzage_w2, rstandard ; label variable nartzage_w2 "age and sex-standardised NART at wave 2" ; xi: regress nart_w3 age_w3 i.sex ; predict nartzage_w3, rstandard ; label variable nartzage_w3 "age and sex-standardised NART at wave 3" ; /*Raven's Progressive Matrices*/ /*range 0-60*/ gen ravens_w1=ravncor ; label variable ravens_w1 "Raven's Matrices number correct at wave 1" ; gen ravens_w2=ravcor2 ; label variable ravens_w2 "Raven's Matrices number correct at wave 2" ; gen ravens_w3=ravcor3 ; label variable ravens_w3 "Raven's Matrices number correct at wave 3" ; /*standardise raven's*/ egen ravensz_w1=std(ravens_w1) ; label variable ravensz_w1 "standardised Raven's Matrices score at wave 1" ; egen ravensz_w2=std(ravens_w2) ; label variable ravensz_w2 "standardised Raven's Matrices score at wave 2" ; egen ravensz_w3=std(ravens_w3) ; label variable ravensz_w3 "standardised Raven's Matrices score at wave 3" ; /*standardise Raven's Matrices score for men and women seprately*/ egen ravenszm_w1=std(ravens_w1) if sex==1; egen ravenszf_w1=std(ravens_w1) if sex==2; label variable ravenszm_w1 "standardised Raven's Matrices score for men at wave 1" ; label variable ravenszf_w1 "standardised Raven's Matrices score for women at wave 1" ; egen ravenszm_w2=std(ravens_w2) if sex==1; egen ravenszf_w2=std(ravens_w2) if sex==2; label variable ravenszm_w2 "standardised Raven's Matrices score for men at wave 2" ; label variable ravenszf_w2 "standardised Raven's Matrices score for women at wave 2" ; egen ravenszm_w3=std(ravens_w3) if sex==1; egen ravenszf_w3=std(ravens_w3) if sex==2; label variable ravenszm_w3 "standardised Raven's Matrices score for men at wave 3" ; label variable ravenszf_w3 "standardised Raven's Matrices score for women at wave 3" ; /*combine in one variable*/ gen ravenszs_w1=. ; replace ravenszs_w1=ravenszm_w1 if sex==1; replace ravenszs_w1=ravenszf_w1 if sex==2; label variable ravenszs_w1 "sex-standardised Raven's Matrices score at wave 1" ; gen ravenszs_w2=.; replace ravenszs_w2=ravenszm_w2 if sex==1; replace ravenszs_w2=ravenszf_w2 if sex==2; label variable ravenszs_w2 "sex-standardised Raven's Matrices score at wave 2" ; gen ravenszs_w3=. ; replace ravenszs_w3=ravenszm_w3 if sex==1; replace ravenszs_w3=ravenszf_w3 if sex==2; label variable ravenszs_w3 "sex-standardised Raven's Matrices score at wave 3" ; /*age and sex-standardised Raven's Matrices score - standardised residuals from regression on age and sex*/ xi: regress ravens_w1 age_w1 i.sex ; predict ravenszage_w1, rstandard ; label variable ravenszage_w1 "age and sex-standardised Raven's Matrices score at wave 1" ; xi: regress ravens_w2 age_w2 i.sex ; predict ravenszage_w2, rstandard ; label variable ravenszage_w2 "age and sex-standardised Raven's Matrices score at wave 2" ; xi: regress ravens_w3 age_w3 i.sex ; predict ravenszage_w3, rstandard ; label variable ravenszage_w3 "age and sex-standardised Raven's Matrices score at wave 3" ; /*WAIS-R Digit symbol test*/ /*range 0-75*/ gen digits_w1=digits ; label variable digits_w1 "WAIS-R Digit symbol test score at wave 1" ; gen digits_w2=dig2 ; label variable digits_w2 "WAIS-R Digit symbol test score at wave 2" ; gen digits_w3=dig3 ; label variable digits_w3 "WAIS-R Digit symbol test score at wave 3" ; /*standardise digit symbol test*/ egen digitsz_w1=std(digits_w1) ; label variable digitsz_w1 "standardised Digit symbol test score at wave 1" ; egen digitsz_w2=std(digits_w2) ; label variable digitsz_w2 "standardised Digit symbol test score at wave 2" ; egen digitsz_w3=std(digits_w3) ; label variable digitsz_w3 "standardised Digit symbol test score at wave 3" ; /*standardise Digit symbol test score for men and women seprately*/ egen digitszm_w1=std(digits_w1) if sex==1; egen digitszf_w1=std(digits_w1) if sex==2; label variable digitszm_w1 "standardised Digit symbol test score for men at wave 1" ; label variable digitszf_w1 "standardised Digit symbol test score for women at wave 1" ; egen digitszm_w2=std(digits_w2) if sex==1; egen digitszf_w2=std(digits_w2) if sex==2; label variable digitszm_w2 "standardised Digit symbol test score for men at wave 2" ; label variable digitszf_w2 "standardised Digit symbol test score for women at wave 2" ; egen digitszm_w3=std(digits_w3) if sex==1; egen digitszf_w3=std(digits_w3) if sex==2; label variable digitszm_w3 "standardised Digit symbol test score for men at wave 3" ; label variable digitszf_w3 "standardised Digit symbol test score for women at wave 3" ; /*combine in one variable*/ gen digitszs_w1=. ; replace digitszs_w1=digitszm_w1 if sex==1; replace digitszs_w1=digitszf_w1 if sex==2; label variable digitszs_w1 "sex-standardised Digit symbol test score at wave 1" ; gen digitszs_w2=. ; replace digitszs_w2=digitszm_w2 if sex==1; replace digitszs_w2=digitszf_w2 if sex==2; label variable digitszs_w2 "sex-standardised Digit symbol test score at wave 2" ; gen digitszs_w3=. ; replace digitszs_w3=digitszm_w3 if sex==1; replace digitszs_w3=digitszf_w3 if sex==2; label variable digitszs_w3 "sex-standardised Digit symbol test score at wave 3" ; /*age and sex-standardised Digit symbol test score - standardised residuals from regression on age and sex*/ xi: regress digits_w1 age_w1 i.sex ; predict digitszage_w1, rstandard ; label variable digitszage_w1 "age and sex-standardised Digit symbol test score at wave 1" ; xi: regress digits_w2 age_w2 i.sex ; predict digitszage_w2, rstandard ; label variable digitszage_w2 "age and sex-standardised Digit symbol test score at wave 2" ; xi: regress digits_w3 age_w3 i.sex ; predict digitszage_w3, rstandard ; label variable digitszage_w3 "age and sex-standardised Digit symbol test score at wave 3" ; /*WAIS-R Block design test*/ /*score 0-50*/ gen block_w1=blockde ; label variable block_w1 "WAIS-R Block Design test score at wave 1" ; gen block_w2=blo2 ; label variable block_w2 "WAIS-R Block Design test score at wave 2" ; gen block_w3=block3 ; label variable block_w3 "WAIS-R Block Design test score at wave 3" ; /*standardise Block design*/ egen blockz_w1=std(block_w1) ; label variable blockz_w1 "standardised Block Design test score at wave 1" ; egen blockz_w2=std(block_w2) ; label variable blockz_w2 "standardised Block Design test score at wave 2" ; egen blockz_w3=std(block_w3) ; label variable blockz_w3 "standardised Block Design test score at wave 3" ; /*standardise Block Design test score for men and women seprately*/ egen blockzm_w1=std(block_w1) if sex==1; egen blockzf_w1=std(block_w1) if sex==2; label variable blockzm_w1 "standardised Block Design test score for men at wave 1" ; label variable blockzf_w1 "standardised Block Design test score for women at wave 1" ; egen blockzm_w2=std(block_w2) if sex==1; egen blockzf_w2=std(block_w2) if sex==2; label variable blockzm_w2 "standardised Block Design test score for men at wave 2" ; label variable blockzf_w2 "standardised Block Design test score for women at wave 2" ; egen blockzm_w3=std(block_w3) if sex==1; egen blockzf_w3=std(block_w3) if sex==2; label variable blockzm_w3 "standardised Block Design test score for men at wave 3" ; label variable blockzf_w3 "standardised Block Design test score for women at wave 3" ; /*combine in one variable*/ gen blockzs_w1=. ; replace blockzs_w1=blockzm_w1 if sex==1; replace blockzs_w1=blockzf_w1 if sex==2; label variable blockzs_w1 "sex-standardised Block Design test score at wave 1" ; gen blockzs_w2=. ; replace blockzs_w2=blockzm_w2 if sex==1; replace blockzs_w2=blockzf_w2 if sex==2; label variable blockzs_w2 "sex-standardised Block Design test score at wave 2" ; gen blockzs_w3=. ; replace blockzs_w3=blockzm_w3 if sex==1; replace blockzs_w3=blockzf_w3 if sex==2; label variable blockzs_w3 "sex-standardised Block Design test score at wave 3" ; /*age and sex-standardised Block Design test score - standardised residuals from regression on age and sex*/ xi: regress block_w1 age_w1 i.sex ; predict blockzage_w1, rstandard ; label variable blockzage_w1 "age and sex-standardised Block Design test score at wave 1" ; xi: regress block_w2 age_w2 i.sex ; predict blockzage_w2, rstandard ; label variable blockzage_w2 "age and sex-standardised Block Design test score at wave 2" ; xi: regress block_w3 age_w3 i.sex ; predict blockzage_w3, rstandard ; label variable blockzage_w3 "age and sex-standardised Block Design test score at wave 3" ; /*use of common objects*/ /*sum of all 9 components used here */ /*however not that subtotals (e.g. otco, otin, otpe) from original data set*/ /*are not quite the same as the sum of the 3 components (e.g. obco+occo+ofco) */ gen objects_w1=obco+occo+ofco+obin+ocin+ofin+obpe+ocpe+ofpe ; gen objects_w2=o2bco+o2cco+o2fco+o2bin+o2cin+o2fin+o2bpe+o2cpe+o2fpe ; gen objects_w3=o3bco+o3cco+o3fco+o3bin+o3cin+o3fin+o3bpe+o3cpe+o3fpe ; label variable objects_w1 "uses of common objects score at wave 1" ; label variable objects_w2 "uses of common objects score at wave 2" ; label variable objects_w3 "uses of common objects score at wave 3" ; /*standardise use of common objects score*/ egen objectsz_w1=std(objects_w1) ; label variable objectsz_w1 "standardised use of common objects score at wave 1" ; egen objectsz_w2=std(objects_w2) ; label variable objectsz_w2 "standardised use of common objects score at wave 2" ; egen objectsz_w3=std(objects_w3) ; label variable objectsz_w3 "standardised use of common objects score at wave 3" ; /*standardise use of common objects score for men and women seprately*/ egen objectszm_w1=std(objects_w1) if sex==1; egen objectszf_w1=std(objects_w1) if sex==2; label variable objectszm_w1 "standardised use of common objects score for men at wave 1" ; label variable objectszf_w1 "standardised use of common objects score for women at wave 1" ; egen objectszm_w2=std(objects_w2) if sex==1; egen objectszf_w2=std(objects_w2) if sex==2; label variable objectszm_w2 "standardised use of common objects score for men at wave 2" ; label variable objectszf_w2 "standardised use of common objects score for women at wave 2" ; egen objectszm_w3=std(objects_w3) if sex==1; egen objectszf_w3=std(objects_w3) if sex==2; label variable objectszm_w3 "standardised use of common objects score for men at wave 3" ; label variable objectszf_w3 "standardised use of common objects score for women at wave 3" ; /*combine in one variable*/ gen objectszs_w1=. ; replace objectszs_w1=objectszm_w1 if sex==1; replace objectszs_w1=objectszf_w1 if sex==2; label variable objectszs_w1 "sex-standardised use of common objects score at wave 1" ; gen objectszs_w2=. ; replace objectszs_w2=objectszm_w2 if sex==1; replace objectszs_w2=objectszf_w2 if sex==2; label variable objectszs_w2 "sex-standardised use of common objects score at wave 2" ; gen objectszs_w3=. ; replace objectszs_w3=objectszm_w3 if sex==1; replace objectszs_w3=objectszf_w3 if sex==2; label variable objectszs_w3 "sex-standardised use of common objects score at wave 3" ; /*age and sex-standardised use of common objects score - standardised residuals from regression on age and sex*/ xi: regress objects_w1 age_w1 i.sex ; predict objectszage_w1, rstandard ; label variable objectszage_w1 "age and sex-standardised use of common objects score at wave 1" ; xi: regress objects_w2 age_w2 i.sex ; predict objectszage_w2, rstandard ; label variable objectszage_w2 "age and sex-standardised use of common objects score at wave 2" ; xi: regress objects_w3 age_w3 i.sex ; predict objectszage_w3, rstandard ; label variable objectszage_w3 "age and sex-standardised use of common objects score at wave 3" ; /*AVLT*/ /*derive totals*/ /*range 0-105 (0-15 in each of 7 tests)*/ /*note: avlttot_w3 is similar to avltot3 already in dataset - but has 8 more people and 2 discrepant scores*/ gen avlttot_w1=avlt1+avlt2+avlt3+avlt4+avlt5+avltb+avltiv ; label variable avlttot_w1 "total auditory verbal learning score at wave 1" ; gen avlttot_w2=avlt2t1+avlt2t2+avlt2t3+avlt2t4+avlt2t5+avlt2tb+avlt2tiv ; label variable avlttot_w2 "total auditory verbal learning score at wave 2" ; gen avlttot_w3=avlt3t1+avlt3t2+avlt3t3+avlt3t4+avlt3t5+avlt3tb+avlt3tvi ; label variable avlttot_w3 "total auditory verbal learning score at wave 3" ; /*standardise AVLT*/ egen avlttotz_w1=std(avlttot_w1) ; label variable avlttotz_w1 "standardised auditory verbal learning score at wave 1" ; egen avlttotz_w2=std(avlttot_w2) ; label variable avlttotz_w2 "standardised auditory verbal learning score at wave 2" ; egen avlttotz_w3=std(avlttot_w3) ; label variable avlttotz_w3 "standardised auditory verbal learning score at wave 3" ; /*standardise auditory verbal learning score for men and women seprately*/ egen avlttotzm_w1=std(avlttot_w1) if sex==1; egen avlttotzf_w1=std(avlttot_w1) if sex==2; label variable avlttotzm_w1 "standardised auditory verbal learning score for men at wave 1" ; label variable avlttotzf_w1 "standardised auditory verbal learning score for women at wave 1" ; egen avlttotzm_w2=std(avlttot_w2) if sex==1; egen avlttotzf_w2=std(avlttot_w2) if sex==2; label variable avlttotzm_w2 "standardised auditory verbal learning score for men at wave 2" ; label variable avlttotzf_w2 "standardised auditory verbal learning score for women at wave 2" ; egen avlttotzm_w3=std(avlttot_w3) if sex==1; egen avlttotzf_w3=std(avlttot_w3) if sex==2; label variable avlttotzm_w3 "standardised auditory verbal learning score for men at wave 3" ; label variable avlttotzf_w3 "standardised auditory verbal learning score for women at wave 3" ; /*combine in one variable*/ gen avlttotzs_w1=. ; replace avlttotzs_w1=avlttotzm_w1 if sex==1; replace avlttotzs_w1=avlttotzf_w1 if sex==2; label variable avlttotzs_w1 "sex-standardised auditory verbal learning score at wave 1" ; gen avlttotzs_w2=. ; replace avlttotzs_w2=avlttotzm_w2 if sex==1; replace avlttotzs_w2=avlttotzf_w2 if sex==2; label variable avlttotzs_w2 "sex-standardised auditory verbal learning score at wave 2" ; gen avlttotzs_w3=.; replace avlttotzs_w3=avlttotzm_w3 if sex==1; replace avlttotzs_w3=avlttotzf_w3 if sex==2; label variable avlttotzs_w3 "sex-standardised auditory verbal learning score at wave 3" ; /*age and sex-standardised auditory verbal learning score - standardised residuals from regression on age and sex*/ xi: regress avlttot_w1 age_w1 i.sex ; predict avlttotzage_w1, rstandard ; label variable avlttotzage_w1 "age and sex-standardised auditory verbal learning score at wave 1" ; xi: regress avlttot_w2 age_w2 i.sex ; predict avlttotzage_w2, rstandard ; label variable avlttotzage_w2 "age and sex-standardised auditory verbal learning score at wave 2" ; xi: regress avlttot_w3 age_w3 i.sex ; predict avlttotzage_w3, rstandard ; label variable avlttotzage_w3 "age and sex-standardised auditory verbal learning score at wave 3" ; /*derive fluid cognitive ability - Gf*/ /*overall z-scores*/ factor avlttotz_w1 digitsz_w1 ravensz_w1 objectsz_w1 blockz_w1, factors(1) pcf ; predict Gf_w1 ; label variable Gf_w1 "Gf at wave 1" ; factor avlttotz_w2 digitsz_w2 ravensz_w2 objectsz_w2 blockz_w2, factors(1) pcf ; predict Gf_w2 ; label variable Gf_w2 "Gf at wave 2" ; factor avlttotz_w3 digitsz_w3 ravensz_w3 objectsz_w3 blockz_w3, factors(1) pcf ; predict Gf_w3 ; label variable Gf_w3 "Gf at wave 3" ; /*age and sex-standardised scores*/ factor avlttotzage_w1 digitszage_w1 ravenszage_w1 objectszage_w1 blockzage_w1, factors(1) pcf ; predict Gfage_w1 ; label variable Gfage_w1 "Gf (age and sex adjusted) at wave 1" ; factor avlttotzage_w2 digitszage_w2 ravenszage_w2 objectszage_w2 blockzage_w2, factors(1) pcf ; predict Gfage_w2 ; label variable Gf_w2 "Gf (age and sex adjusted) at wave 2" ; factor avlttotzage_w3 digitszage_w3 ravenszage_w3 objectszage_w3 blockzage_w3, factors(1) pcf ; predict Gfage_w3 ; label variable Gf_w3 "Gf (age and sex adjusted) at wave 3" ; /*Other cognitive tests*/ /*MMSE scores*/ /*Note: MMSE scores are highly skewed*/ gen mmse_w1=mmse ; label variable mmse_w1 "MMSE at wave 1" ; gen mmse_w2=mmse2 ; label variable mmse_w2 "MMSE at wave 2" ; gen mmse_w3=mmse3 ; label variable mmse_w3 "MMSE at wave 3" ;