******************************************************************** * File HALCyon PC covariate syntax_ELSA.do * BY Rachel Cooper, 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 English Longitudinal Study of Ageing * Date Created 27/08/2009 * last modified 13/01/2012 * PURPOSE Recodes and derives physical capability variables, basic sociodemographic variables * and indicators of socioeconomic position for use in cross-cohort analyses * NOTE Suffix (_wx) added to all variable names to indicate survey wave; syntax created for relevant data from waves 0 to 3 ************************************************************************************* # delimit; set more off; /*Creating break between newly recoded variables and variables in existing dataset with a blank variable */ gen recodes_below=. ; /*********************************************************************************/ /*Standard names and categories for demographic variables */ /* SEX */ gen sex=allsexin ; recode sex -1=. ; label variable sex "Sex of study participant" ; label define sexlab 1 "Male" 2 "Female" ; label values sex sexlab ; /*AGE */ /*ELSA user guides suggest that indager variables should be used (dhager variables reported in household grid whereas indager variables */ /*have been calculated usind verified date of birth and date of interview variables)*/ gen age_w1=indagerw1 ; gen age_w2=indagerw2 ; gen age_w2n=confagew2n ; gen age_w3=indagerw3 ; recode age_w3 -9=. -8=. ; label variable age_w1 "Age at wave 1" ; label variable age_w2 "Age at wave 2" ; label variable age_w2n "Age at wave 2 nurse assessment" ; label variable age_w3 "Age at wave 3" ; /*Categories of age at wave 1 (range 20-99) */ /*in 10 year age groups <50, 50-59, 60-69, 70-79, 80-89, 90+ */ gen agecat_w1=age_w1 ; recode agecat_w1 (min/49.999=0)(50/59.999=1)(60/69.999=2) (70/79.999=3) (80/89.999=4)(90/99.999=5) ; label variable agecat_w1 "Age at wave 1 (10y cat.)" ; label define agelab 0 "<50" 1 "50-59" 2 "60-69" 3 "70-79" 4 "80-89" 5 "90+" ; label values agecat_w1 agelab ; /*in 5 year age groups <50, 50-54, 55-59, 60-64, 65-69, 70-74, 75-79, 80-84, 85-89, 90+ years */ gen agecat5_w1=age_w1 ; recode agecat5_w1 (min/49.999=0)(50/54.999=1)(55/59.999=2)(60/64.999=3)(65/69.999=4)(70/74.999=5)(75/79.999=6)(80/84.999=7)(85/89.999=8)(90/99.999=9) ; label variable agecat5_w1 "Age at wave 1 (5y cat.)" ; label define age5lab 0 "<50" 1 "50-54" 2 "55-59" 3 "60-64" 4 "65-69" 5 "70-74" 6 "75-79" 7 "80-84" 8 "85-89" 9 "90+" ; label values agecat5_w1 age5lab ; /*Categories of age at wave 2 (range 17-99) */ /*in 10 year age groups <50, 50-59, 60-69, 70-79, 80-89, 90+ */ gen agecat_w2=age_w2 ; recode agecat_w2 (min/49.999=0) (50/59.999=1) (60/69.999=2) (70/79.999=3) (80/89.999=4) (90/99.999=5) ; label variable agecat_w2 "Age at wave 2 (10y cat.)" ; label values agecat_w2 agelab ; /*in 5 year age groups <50, 50-54, 55-59, 60-64, 65-69, 70-74, 75-79, 80-84, 85-89, 90+ years */ gen agecat5_w2=age_w2 ; recode agecat5_w2 (min/49.999=0)(50/54.999=1)(55/59.999=2)(60/64.999=3)(65/69.999=4)(70/74.999=5)(75/79.999=6)(80/84.999=7)(85/89.999=8)(90/99.999=9) ; label variable agecat5_w2 "Age at wave 2 (5y cat.)" ; label values agecat5_w2 age5lab ; /*Categories of age at wave 2 nurse assessment (range 52-99) */ /*in 10 year age groups <50, 50-59, 60-69, 70-79, 80-89, 90+ */ gen agecat_w2n=age_w2n ; recode agecat_w2n (min/49.999=0)(50/59.999=1)(60/69.999=2) (70/79.999=3) (80/89.999=4)(90/99.999=5) ; label variable agecat_w2n "Age at wave 2 nurse assessment (10y cat.)" ; label values agecat_w2n agelab ; /*in 5 year age groups <50, 50-54, 55-59, 60-64, 65-69, 70-74, 75-79, 80-84, 85-89, 90+ years */ gen agecat5_w2n=age_w2n ; recode agecat5_w2n (min/49.999=0)(50/54.999=1)(55/59.999=2)(60/64.999=3)(65/69.999=4)(70/74.999=5)(75/79.999=6)(80/84.999=7)(85/89.999=8)(90/99.999=9) ; label variable agecat5_w2n "Age at wave 2 nurse assessment (5y cat.)" ; label values agecat5_w2n age5lab ; /*Categories of age at wave 3 (range 19-99) */ /*in 10 year age groups <50, 50-59, 60-69, 70-79, 80-89, 90+ */ gen agecat_w3=age_w3 ; recode agecat_w3 (min/49.999=0)(50/59.999=1)(60/69.999=2) (70/79.999=3) (80/89.999=4)(90/99.999=5) ; label variable agecat_w3 "Age at wave 3 (10y cat.)" ; label values agecat_w3 agelab ; /*in 5 year age groups <50, 50-54, 55-59, 60-64, 65-69, 70-74, 75-79, 80-84, 85-89, 90+ years */ gen agecat5_w3=age_w3 ; recode agecat5_w3 (min/49.999=0)(50/54.999=1)(55/59.999=2)(60/64.999=3)(65/69.999=4)(70/74.999=5)(75/79.999=6)(80/84.999=7)(85/89.999=8)(90/99.999=9) ; label variable agecat5_w3 "Age at wave 3 (5y cat.)" ; label values agecat5_w3 age5lab ; /*Variable to identify those who are 'core' study participants */ gen coremember=. ; replace coremember=1 if finstatin=="C1CM" ; label variable coremember "Core member of study" ; /*Variable to identify those aged 50 or over at wave 1 */ gen age50plus=. ; replace age50plus=1 if age_w1>=50 & age_w1!=. ; label variable age50plus "Aged 50+ at wave 1" ; /*********************************************************************************/ /* PHYSICAL CAPABILITY MEASURES */ /*WALKING TIME */ /*2 trials of walking time measured at waves 1, 2 & 3 - time (seconds) taken to walk 8ft at usual pace */ /* Wave 1 */ /*Trial 1 */ gen walktimet1_w1=mmwlkaw1 ; recode walktimet1_w1 -9=. -8=. -1=. ; /*Coding outliers to missing */ replace walktimet1_w1=. if mmwlkaw1>=150 | mmwlkaw1<1 ; label variable walktimet1_w1 "Walking time(s), trial 1, wave 1" ; /*Trial 2 */ gen walktimet2_w1=mmwlkbw1 ; recode walktimet2_w1 -9=. -8=. -1=. ; /*Coding outliers to missing */ replace walktimet2_w1=. if mmwlkbw1>=150 | mmwlkbw1<1 ; label variable walktimet2_w1 "Walking time(s), trial 2, wave 1" ; /*Fastest walking time over 2 trials */ gen bestwalktime_w1=min(walktimet1_w1, walktimet2_w1) ; label variable bestwalktime_w1 "Best walking time (s), wave 1" ; /* Average walking time over 2 trials */ gen avwalktime_w1=(walktimet1_w1+walktimet2_w1)/2 ; /*Allowing people to be included who only have 1 measure */ replace avwalktime_w1=walktimet1_w1 if walktimet1_w1!=. & walktimet2_w1==. ; replace avwalktime_w1=walktimet2_w1 if walktimet2_w1!=. & walktimet1_w1==. ; label variable avwalktime_w1 "Average walking time (s), wave 1" ; /*Using walking times to calculate walking speeds */ /*Walking time measured over 8 feet which is 2.438m */ /*Trial 1 */ gen walkspeedt1_w1=2.438/walktimet1_w1 ; label variable walkspeedt1_w1 "Walking speed (m/s), trial 1, wave 1" ; /*Trial 2 */ gen walkspeedt2_w1=2.438/walktimet2_w1 ; label variable walkspeedt2_w1 "Walking speed (m/s), trial 2, wave 1" ; /*Fastest walking speed over 2 trials */ gen bestwalkspeed_w1=max(walkspeedt1_w1, walkspeedt2_w1) ; label variable bestwalkspeed_w1 "Best walking speed (m/s), wave 1" ; /* Average walking speed over 2 trials */ gen avwalkspeed_w1=(walkspeedt1_w1+walkspeedt2_w1)/2 ; /*Allowing people to be included who only have 1 measure */ replace avwalkspeed_w1=walkspeedt1_w1 if walkspeedt1_w1!=. & walkspeedt2_w1==. ; replace avwalkspeed_w1=walkspeedt2_w1 if walkspeedt2_w1!=. & walkspeedt1_w1==. ; label variable avwalkspeed_w1 "Average walking speed (m/s), wave 1" ; /* Wave 2 */ /*Trial 1 */ gen walktimet1_w2=MMWlkAw2 ; recode walktimet1_w2 -9=. -8=. -1=. ; /*Coding outliers to missing (there are none outside this range at this wave but left in for consistency with wave 1)*/ replace walktimet1_w2=. if MMWlkAw2>=150 | MMWlkAw2<1 ; label variable walktimet1_w2 "Walking time(s), trial 1, wave 2" ; /*Trial 2 */ gen walktimet2_w2=MMWlkBw2 ; recode walktimet2_w2 -9=. -8=. -1=. ; /*Coding outliers to missing (there are none outside this range at this wave but left in for consistency with wave 1)*/ replace walktimet2_w2=. if MMWlkBw2>=150 | MMWlkBw2<1 ; label variable walktimet2_w2 "Walking time(s), trial 2, wave 2" ; /*Fastest walking time over 2 trials */ gen bestwalktime_w2=min(walktimet1_w2, walktimet2_w2) ; label variable bestwalktime_w2 "Best walking time (s), wave 2" ; /* Average walking time over 2 trials */ gen avwalktime_w2=(walktimet1_w2+walktimet2_w2)/2 ; /*Allowing people to be included who only have 1 measure */ replace avwalktime_w2=walktimet1_w2 if walktimet1_w2!=. & walktimet2_w2==. ; replace avwalktime_w2=walktimet2_w2 if walktimet2_w2!=. & walktimet1_w2==. ; label variable avwalktime_w2 "Average walking time (s), wave 2" ; /*Using walking times to calculate walking speeds */ /*Walking time measured over 8 feet which is 2.438m */ /*Trial 1 */ gen walkspeedt1_w2=2.438/walktimet1_w2 ; label variable walkspeedt1_w2 "Walking speed (m/s), trial 1, wave 2" ; /*Trial 2 */ gen walkspeedt2_w2=2.438/walktimet2_w2 ; label variable walkspeedt2_w2 "Walking speed (m/s), trial 2, wave 2" ; /*Fastest walking speed over 2 trials */ gen bestwalkspeed_w2=max(walkspeedt1_w2, walkspeedt2_w2) ; label variable bestwalkspeed_w2 "Best walking speed (m/s), wave 2" ; /* Average walking speed over 2 trials */ gen avwalkspeed_w2=(walkspeedt1_w2+walkspeedt2_w2)/2 ; /*Allowing people to be included who only have 1 measure */ replace avwalkspeed_w2=walkspeedt1_w2 if walkspeedt1_w2!=. & walkspeedt2_w2==. ; replace avwalkspeed_w2=walkspeedt2_w2 if walkspeedt2_w2!=. & walkspeedt1_w2==. ; label variable avwalkspeed_w2 "Average walking speed (m/s), wave 2" ; /* Wave 3 */ /*Trial 1 */ gen walktimet1_w3=MMWlkAw3 ; recode walktimet1_w3 -9=. -8=. -1=. ; /*Coding outliers to missing (there are none outside this range at this wave but left in for consistency with wave 1)*/ replace walktimet1_w3=. if MMWlkAw3>=150 | MMWlkAw3<1 ; label variable walktimet1_w3 "Walking time(s), trial 1, wave 3" ; /*Trial 2 */ gen walktimet2_w3=MMWlkBw3 ; recode walktimet2_w3 -9=. -8=. -1=. ; /*Coding outliers to missing (there are none outside this range at this wave but left in for consistency with wave 1)*/ replace walktimet2_w3=. if MMWlkBw3>=150 | MMWlkBw3<1 ; label variable walktimet2_w3 "Walking time(s), trial 2, wave 3" ; /*Fastest walking time over 2 trials */ gen bestwalktime_w3=min(walktimet1_w3, walktimet2_w3) ; label variable bestwalktime_w3 "Best walking time (s), wave 3" ; /* Average walking time over 2 trials */ gen avwalktime_w3=(walktimet1_w3+walktimet2_w3)/2 ; /*Allowing people to be included who only have 1 measure */ replace avwalktime_w3=walktimet1_w3 if walktimet1_w3!=. & walktimet2_w3==. ; replace avwalktime_w3=walktimet2_w3 if walktimet2_w3!=. & walktimet1_w3==. ; label variable avwalktime_w3 "Average walking time (s), wave 3" ; /*Using walking times to calculate walking speeds */ /*Walking time measured over 8 feet which is 2.438m */ /*Trial 1 */ gen walkspeedt1_w3=2.438/walktimet1_w3 ; label variable walkspeedt1_w3 "Walking speed (m/s), trial 1, wave 3" ; /*Trial 2 */ gen walkspeedt2_w3=2.438/walktimet2_w3 ; label variable walkspeedt2_w3 "Walking speed (m/s), trial 2, wave 3" ; /*Fastest walking speed over 2 trials */ gen bestwalkspeed_w3=max(walkspeedt1_w3, walkspeedt2_w3) ; label variable bestwalkspeed_w3 "Best walking speed (m/s), wave 3" ; /* Average walking speed over 2 trials */ gen avwalkspeed_w3=(walkspeedt1_w3+walkspeedt2_w3)/2 ; /*Allowing people to be included who only have 1 measure */ replace avwalkspeed_w3=walkspeedt1_w3 if walkspeedt1_w3!=. & walkspeedt2_w3==. ; replace avwalkspeed_w3=walkspeedt2_w3 if walkspeedt2_w3!=. & walkspeedt1_w3==. ; label variable avwalkspeed_w3 "Average walking speed (m/s), wave 3" ; /* GRIP STRENGTH */ /*Measured 3 times in each hand at wave 2 nurse assessment using Smedley hand dynamometer */ gen gripd1_w2=mmgsd1w2n ; gen gripd2_w2=mmgsd2w2n ; gen gripd3_w2=mmgsd3w2n ; gen gripn1_w2=mmgsn1w2n ; gen gripn2_w2=mmgsn2w2n ; gen gripn3_w2=mmgsn3w2n ; mvdecode gripd1_w2 gripd2_w2 gripd3_w2 gripn1_w2 gripn2_w2 gripn3_w2, mv(-1, -9, -8) ; label variable gripd1_w2 "Grip strength (kg), dom hand, trial 1, wave 2" ; label variable gripd2_w2 "Grip strength (kg), dom hand, trial 2, wave 2" ; label variable gripd3_w2 "Grip strength (kg), dom hand, trial 3, wave 2" ; label variable gripn1_w2 "Grip strength (kg), non-dom hand, trial 1, wave 2" ; label variable gripn2_w2 "Grip strength (kg), non-dom hand, trial 2, wave 2" ; label variable gripn3_w2 "Grip strength (kg), non-dom hand, trial 3, wave 2" ; /*Best grip strength - dominant, nondominant and overall */ gen maxgripd_w2=max(gripd1_w2, gripd2_w2, gripd3_w2) ; gen maxgripn_w2=max(gripn1_w2, gripn2_w2, gripn3_w2) ; gen bestgrip_w2=max(maxgripd_w2, maxgripn_w2) ; label variable maxgripd_w2 "Maximum grip strength (kg), dom hand, wave 2" ; label variable maxgripn_w2 "Maximum grip strength (kg), non-dom hand, wave 2" ; label variable bestgrip_w2 "Best grip strength (kg), overall, wave 2" ; /*Average grip strength */ egen gripmissing=rmiss(gripd1_w2-gripn3_w2) ; label variable gripmissing "No. of missing grip values, wave 2" ; egen griptot=rsum(gripd1_w2-gripn3_w2) if gripmissing>=0 & gripmissing<6 ; label variable griptot "Sum of grip values, wave 2" ; gen avgrip_w2=. ; replace avgrip_w2=griptot/6 if gripmissing==0 ; replace avgrip_w2=griptot/4 if gripmissing==2 ; replace avgrip_w2=griptot/3 if gripmissing==3 ; label variable avgrip_w2 "Average grip strength (kg), wave 2" ; /* CHAIR RISES */ /* Measured once at wave 2 nurse assessment */ /*For all participants who could do a single chair rise time to complete 5 chair rises was recorded */ /*For those under 70y 10 chair rises were performed (during same trial nurses recorded time for 5 and 10 chair rises) */ /* Time for 5 chair rises */ /*exclude those who completed less than 5 chair rises (n=79) in creating variable */ gen chairtime5_w2=mmrrftiw2n if mmrrrew2n>=5 & mmrrrew2n!=. ; recode chairtime5_w2 -9=. -8=. -3=. -1=. ; label variable chairtime5_w2 "Chair rise time (s), 5 rises, wave 2" ; /*recode to missing people with values of <1s per chair rise */ replace chairtime5_w2=. if chairtime5_w2<5 ; /*Natural log transformation */ gen lnchairtime5_w2=ln(chairtime5_w2) ; label variable lnchairtime5_w2 "ln(chair rise time(5) w2)" ; /*Reciprocal */ gen rpchairtime5_w2=(1/chairtime5_w2)*100 ; label variable rpchairtime5_w2 "Reciprocal of chair rise time(5), wave 2" ; /* Time for 10 chair rises */ /*exclude those who completed less than 10 chair rises in creating variable */ gen chairtime10_w2=mmrrttiw2n if mmrrrew2n==10 ; recode chairtime10_w2 -9=. -8=. -3=. -1=. ; label variable chairtime10_w2 "Chair rise time (s), 10 rises, wave 2" ; /*recode to missing people with values of <1s per chair rise */ replace chairtime10_w2=. if chairtime10_w2<10 ; /*Natural log transformation */ gen lnchairtime10_w2=ln(chairtime10_w2) ; label variable lnchairtime10_w2 "ln(chair rise time(10) w2)" ; /*Reciprocal */ gen rpchairtime10_w2=(1/chairtime10_w2)*100 ; label variable rpchairtime10_w2 "Reciprocal of chair rise time(10), wave 2" ; /*Generating a variable to indicate those unable to rise from a chair */ gen chairunable_w2=mmcrrew2n ; recode chairunable_w2 1=0 2=1 3=1 -1=. ; label variable chairunable_w2 "Unable to rise from a chair?" ; label define chairlab 0 "Able" 1 "Unable" ; label values chairunable_w2 chairlab ; /* STANDING BALANCE */ /*Tandem stands at wave 2 nurse visit */ /*all participants asked to perform a side by side stand */ /*if held side by side stand for 10s then asked to perform semi-tandem stand */ /*if held semi-tandem stand for 10s then asked to perform a full-tandem stand (for 30s if <=69y and for 10s if >69y) */ /*Information from these tests can be used to derive a balance score (0-4) as in Guralnik et al J Gerontol 1994;49(2):M85-94 */ gen balancesc=. ; replace balancesc=0 if mmssrew2n==2 | mmssrew2n==3 ; replace balancesc=1 if mmssrew2n==1 & (mmstrew2n==2 | mmstrew2n==3) ; replace balancesc=2 if mmssrew2n==1 & mmstrew2n==1 & (mmftre2w2n==5 | ((mmftre2w2n==2 | mmftre2w2n==4) & (mmfttiw2n>=0 & mmfttiw2n<=2))) ; replace balancesc=3 if mmssrew2n==1 & mmstrew2n==1 & ((mmftre2w2n==2 | mmftre2w2n==4) & (mmfttiw2n>2 & mmfttiw2n<=9.999)) ; replace balancesc=4 if mmssrew2n==1 & mmstrew2n==1 & ((mmftre2w2n==1 | mmftre2w2n==3) | (mmftre2w2n==4 & (mmfttiw2n>=10 & mmfttiw2n!=.))) ; label variable balancesc "Balance score, wave 2" ; label define ballab 0 "Unable/not attempted/side-by-side 0-9" 1 "Side-by-side 10s, semi-t 0-9s or unable" 2 "Semi-t 10s, full-t 0-2 or unable" 3 "Semi-t 10s, full-t 3-9s" 4 "Semi-t 10s, full-t 10s" ; label values balancesc ballab ; /*Generating a 'poor balance' binary variable equivalent to that in KN Stevens et al Age Ageing 2008;37:300-305 */ gen balancesc_bin=balancesc ; recode balancesc_bin 0/3=1 4=0 ; label variable balancesc_bin "Poor balance (balance score <=3)" ; label define balalab 1 "Yes (score=0-3)" 0 "No (score=4)" ; label values balancesc_bin balalab ; /*Creating a variable 'able to balance for 5s' yes vs no for comparability with other cohorts */ gen tandem_5_w2=. ; replace tandem_5_w2=0 if balancesc>=0 & balancesc<=2 ; replace tandem_5_w2=0 if ((mmftre2w2n==2 | mmftre2w2n==4) & (mmfttiw2n>=0 & mmfttiw2n<=4.999)) ; replace tandem_5_w2=1 if ((mmftre2w2n==1 | mmftre2w2n==3) | ((mmftre2w2n==2 | mmftre2w2n==4) & (mmfttiw2n>=5 & mmfttiw2n!=.))) ; label variable tandem_5_w2 "Able to balance for 5s?, assessed using tandem stands" ; label define yeslab 0 "No" 1 "Yes" ; label values tandem_5_w2 yeslab ; /*Coding tandem variable the alternative way so that inability to balance is the 'positive' outcome */ gen tandem_5_w2_opp=. ; replace tandem_5_w2_opp=1 if tandem_5_w2==0 ; replace tandem_5_w2_opp=0 if tandem_5_w2==1 ; label variable tandem_5_w2_opp "Able to balance for at least 5s?, assessed using tandem stands" ; label define nolab 1 "No" 0 "Yes" ; label values tandem_5_w2_opp nolab ; /*Not possible to create comparable variable for balance for 30s as not all participants asked to attempt to balance for 30s */ /*However, the times can be added to create a variable which indicates how long (out of total of 30s, 3 stands of 10s) a participant */ /*has stood for */ gen tandemtime_w2=. ; /*Coding those who were unable to hold the side by side stand for 10s with the time they did hold the stand for */ replace tandemtime_w2=mmsstiw2n if mmssrew2n==2 ; /*Coding those who were unable to perform the side by side stand with a time of 0 */ replace tandemtime_w2=0 if mmssrew2n==3 ; /*Coding those who were unable to hold the semi-tandem stand for 10s with the time they did hold the stand for (plus the 10s they held the */ /*side by side stand for */ replace tandemtime_w2=(10+mmsttiw2n) if mmstrew2n==2 ; /*Coding those who held first 2 stands with time (plus 20s) that they held the final tandem stand */ replace tandemtime_w2=30 if mmftre2w2n==1 | mmftre2w2n==3 ; replace tandemtime_w2=(20+mmfttiw2n) if mmftre2w2n==2 ; replace tandemtime_w2=(20+mmfttiw2n) if mmftre2w2n==4 & mmfttiw2n<10 ; replace tandemtime_w2=30 if mmftre2w2n==4 & mmfttiw2n>=10 ; /*Coding in those who completed side by side stand but unable to attempt semi-tandem stand */ replace tandemtime_w2=10 if mmssrew2n==1 & mmstrew2n==3 ; /*Coding in those who completed semi-tandem stand but unable to attempt tandem stand*/ replace tandemtime_w2=20 if mmstrew2n==1 & mmftre2w2n==5 ; label variable tandemtime_w2 "Tandem stand time (3 tandem stands)" ; /*In addition to the tandem stands if aged 69y and under and able to hold side-by-side stand for 10s participants were asked to perform */ /*standing balance test (referred to as leg raise) for 30s with eyes open. If they successfully did this they were then asked */ /*to perform balance test again with eyes closed for up to 30s */ /*This information cannot easily be used as it excludes all those who have not taken the test, it may therefore be preferable */ /*to use the variables derived above however, variables are created below for those 69y and under and those 70y and over which */ /*can be used if these 2 age groups are analysed separately */ gen balancetimeu69_w2=. ; replace balancetimeu69_w2=30 if mmlorew2n==1 ; replace balancetimeu69_w2=mmlotiw2n if mmlorew2n==2 ; replace balancetimeu69_w2=0 if mmlorew2n==3 & age_w2n<70 ; replace balancetimeu69_w2=0 if (mmssrew2n==2 | mmssrew2n==3) & age_w2n<70 ; replace balancetimeu69_w2=0 if (mmstrew2n==2 | mmstrew2n==3) & age_w2n<70 ; replace balancetimeu69_w2=. if age_w2n>=70 ; label variable balancetimeu69_w2 "Balance time (eyes open), under 70y only" ; /*Binary categorisations of balance time variable */ /*Able to complete at least 5 seconds */ gen balanceu69_5_w2=balancetimeu69_w2 ; recode balanceu69_5_w2 (min/4.99=0) (5/30=1) ; label variable balanceu69_5_w2 "Able to balance for at least 5s w2?, under 70y" ; label values balanceu69_5_w2 yeslab ; /*Coding balance the alternative way so that inability to balance is the 'positive' outcome */ gen balanceu69_5_w2_opp=. ; replace balanceu69_5_w2_opp=1 if balanceu69_5_w2==0 ; replace balanceu69_5_w2_opp=0 if balanceu69_5_w2==1 ; label variable balanceu69_5_w2_opp "Able to balance for at least 5s w2?, under 70y" ; label values balanceu69_5_w2_opp nolab ; /*Creating a categorisation of this balance time which instead of using a specific time as a cut-point, identifies those in the bottom */ /*20% of performance by sex in the age group <=69y and who are core members */ egen bal20m_w2=cut(balancetimeu69_w2) if sex==1 & coremember==1, group(5) ; egen bal20f_w2=cut(balancetimeu69_w2) if sex==2 & coremember==1, group(5) ; /*table bal20m_w2, c(min balancetimeu69_w2 max balancetimeu69_w2) ; table bal20f_w2, c(min balancetimeu69_w2 max balancetimeu69_w2) ; */ gen balance_b20_u69_w2=. ; replace balance_b20_u69_w2=bal20m_w2 if sex==1 & bal20m_w2!=. ; replace balance_b20_u69_w2=bal20f_w2 if sex==2 & bal20f_w2!=. ; recode balance_b20_u69_w2 1/4=0 0=1 ; label variable balance_b20_u69_w2 "In bottom 20% of balance times for ages <70y, wave 2" ; label define b20lab 0 "Top 80%" 1 "Bottom 20%" ; label values balance_b20_u69_w2 b20lab ; label variable bal20m_w2 "Quintiles of balance time under 70y, wave 2, men" ; label variable bal20f_w2 "Quintiles of balance time under 70y, wave 2, women" ; /*Generating a balance time (eyes open, standing on 1 leg i.e. the full tandem stand for up to 10s) to create categories */ gen balancetimeo70_w2=. ; replace balancetimeo70_w2=10 if mmftre2w2n==1 ; replace balancetimeo70_w2=10 if (mmftre2w2n==3 | (mmftre2w2n==4 & mmfttiw2n>=10)) & age_w2n>=70 ; replace balancetimeo70_w2=mmfttiw2n if (mmftre2w2n==4 & mmfttiw2n<10) & age_w2n>=70 ; replace balancetimeo70_w2=mmfttiw2n if mmftre2w2n==2 ; replace balancetimeo70_w2=0 if mmftre2w2n==5 & age_w2n>=70 ; replace balancetimeo70_w2=0 if (mmstrew2n==2 | mmstrew2n==3) & age_w2n>=70 ; replace balancetimeo70_w2=0 if (mmssrew2n==2 | mmssrew2n==3) & age_w2n>=70 ; replace balancetimeo70_w2=. if age_w2n<70 ; label variable balancetimeo70_w2 "Balance time (eyes open), 70y+ (max 10s)" ; /*Binary categorisations of balance time variable */ /*Able to complete at least 5 seconds */ gen balanceo70_5_w2=balancetimeo70_w2 ; recode balanceo70_5_w2 (min/4.99=0) (5/10=1) ; label variable balanceo70_5_w2 "Able to balance for at least 5s w2?, 70y+" ; label values balanceo70_5_w2 yeslab ; /*Coding balance the alternative way so that inability to balance is the 'positive' outcome */ gen balanceo70_5_w2_opp=. ; replace balanceo70_5_w2_opp=1 if balanceo70_5_w2==0 ; replace balanceo70_5_w2_opp=0 if balanceo70_5_w2==1 ; label variable balanceo70_5_w2_opp "Able to balance for at least 5s w2?, 70y+" ; label values balanceo70_5_w2_opp nolab ; /*Creating a categorisation of this balance time which instead of using a specific time as a cut-point, identifies those in the bottom */ /*20% of performance by sex in the age group >=70y and who are core members */ egen bal20mo70_w2=cut(balancetimeo70_w2) if sex==1 & coremember==1, group(5) ; egen bal20fo70_w2=cut(balancetimeo70_w2) if sex==2 & coremember==1, group(5) ; /*table bal20mo70_w2, c(min balancetimeo70_w2 max balancetimeo70_w2) ; table bal20fo70_w2, c(min balancetimeo70_w2 max balancetimeo70_w2) ;*/ gen balance_b20_o70_w2=. ; replace balance_b20_o70_w2=bal20mo70_w2 if sex==1 & bal20mo70_w2!=. ; replace balance_b20_o70_w2=bal20fo70_w2 if sex==2 & bal20fo70_w2!=. ; recode balance_b20_o70_w2 1/4=0 0=1 ; label variable balance_b20_o70_w2 "In bottom 20% of balance times for ages 70y+, wave 2" ; label values balance_b20_o70_w2 b20lab ; label variable bal20mo70_w2 "Quintiles of balance time 70y+, wave 2, men" ; label variable bal20fo70_w2 "Quintiles of balance time 70y+, wave 2, women" ; /*******************/ /*Unable variables */ gen gripunable=. ; replace gripunable=1 if mmgswilw2n==3 ; replace gripunable=0 if bestgrip_w2!=. ; label variable gripunable "Unable to perform grip test?" ; label define unablelab 0 "Able" 1 "Unable" ; label values gripunable unablelab ; gen chairunablex=. ; /*No appropriate chair */ replace chairunablex=3 if mmcravw2n==2 ; /*Respondent does not feel it is safe */ replace chairunablex=1 if mmcrscw2n==2 | mmrrscw2n==2 ; /*Respondent did not complete 5 rises */ replace chairunablex=2 if mmrrrew2n>=0 & mmrrrew2n<5 ; /*respondent refused */ replace chairunablex=4 if mmrrnaw2n==7 ; replace chairunablex=0 if chairtime5_w2!=. ; label variable chairunablex "Unable to perform chair rise test? - detail" ; label define unablexlab 0 "Able" 1 "Unable - does not feel it is safe" 2 "Unable to complete 5 rises" 3 "No appropriate chair" 4 "Respondent refusal" ; label values chairunablex unablexlab ; /*creating binary version of variable */ gen chairunable=. ; replace chairunable=1 if chairunablex==1 | chairunablex==2 ; replace chairunable=0 if chairunablex==0 ; label variable chairunable "Unable to perform chair rise test?" ; label values chairunable unablelab ; /*Walking at wave 2 */ /*Unable */ gen walkunablex=. ; /*People with health conditions that prevent them from walking */ replace walkunablex=1 if bestwalkspeed_w2==. & (MmHSSw2>=2 & MmHSSw2<=4) ; /*Unable to complete the test or test stopped by interviewer for safety reasons */ recode walkunablex .=2 if bestwalkspeed_w2==. & (MmTryaw2==2 | MmTryaw2==3 | MmTrybw2==2 | MmTrybw2==3) ; /*Respondent or interviewer felt the walk test would not be safe */ recode walkunablex .=3 if bestwalkspeed_w2==. & (MmWalaw2==2 | MmSafw2==2) ; /*Respondent unable to walk alone with aid or able to walk alone with aid but aid unavailable */ recode walkunablex .=4 if bestwalkspeed_w2==. & (MmAlonew2==2 | MmAlonew2==3) ; /*Able */ recode walkunablex .=0 if bestwalkspeed_w2!=. ; label variable walkunablex "Unable to perform walking test? - detail" ; label define unablexxlab 0 "Able" 1 "Unable - health condition prevent them from walking" 2 "Unable to complete the test" 3 "Not safe to conduct test" 4 "Unable to walk alone even with aid or aid unavailable" ; label values walkunablex unablexxlab ; /*creating binary version of variable */ gen walkunable=. ; replace walkunable=1 if walkunablex>=1 & walkunablex<=4 ; replace walkunable=0 if walkunablex==0 ; label variable walkunable "Unable to perform walking test?" ; label values walkunable unablelab ; /*Walking aid */ gen walkaid=. ; replace walkaid=1 if bestwalkspeed_w2!=. & (MmAidw2>=2 & MmAidw2<=85) ; replace walkaid=0 if bestwalkspeed_w2!=. & MmAidw2==1 ; replace walkaid=9 if bestwalkspeed_w2!=. & (MmAidw2==-9 | MmAidw2==-8) ; label variable walkaid "Walking aid used?" ; label define aidlab 0 "No" 1 "Yes" 9 "Unknown" ; label values walkaid aidlab ; /***************************************************************************************/ /*SOCIOECONOMIC POSITION */ /*Childhood SEP */ /*Father's occupation when participant aged 14y (retrospective ascertainment)(asked at 3 waves but only if not answered at previous wave)*/ recode difjobw1 -9=. -8=. -1=. ; recode DiFJobw2 -9=. -8=. -1=. ; recode DiFJobw3 -9=. -8=. -1=. ; gen fathjob=difjobw1 ; replace fathjob=DiFJobw2 if difjobw1==. & DiFJobw2!=. ; replace fathjob=DiFJobw3 if fathjob==. & DiFJobw3!=. ; /*Recoding the 15 categories using an amended version of Panos Demakakos' suggested method */ gen occ_fath=fathjob ; recode occ_fath 1=. 2/4=1 5/8=2 9/10=3 12=3 11=. 13=. 14/15=4 ; label variable occ_fath "Father's occupation" ; label define focclab 1 "Managerial/professional/technical occupations/own business" 2 "Administrative/clerical/secretarial/Skilled trade/services sector" 3 "Manual worker/casual jobs" 4 "Unemployed/sick/disabled" ; label values occ_fath focclab ; drop fathjob ; /*Adult SEP */ /*Own RGSC occupational class in adulthood */ gen occ_adult_own=scallxw0 ; /*coding to missing those with unknown RGSC classification */ recode occ_adult_own -9=. -1=. 7=. 8=. 9=. 10=. 11=. ; label variable occ_adult_own "Own adult occupational class" ; label define seplab 1 "I" 2 "II" 3 "IIINM" 4 "IIIM" 5 "IV" 6 "V" ; label values occ_adult_own seplab ; /*RGSC occupational class of head of household */ gen occ_adult_hh=schohw0 ; /*coding to missing those with unknown RGSC classification */ recode occ_adult_hh -9=. -8=. -5=. -1=. 7=. 8=. 9=. 10=. 11=. ; label variable occ_adult_hh "Head of household adult occupational class" ; label values occ_adult_hh seplab ; /*Education variables */ /*Age at leaving full-time education - asked at every wave (but only usually of those people who had answered at previous wave) */ recode educendw0 -9=. -8=. -1=. 1=. ; recode fqendw1 -9=. -8=. -1=. 1=. ; recode FqEndw2 -9=. -8=. -1=. 1=. ; recode FqEndw3 -9=. -8=. -1=. 1=. ; gen agelefted=educendw0 ; replace agelefted=fqendw1 if educendw0==. & fqendw1!=. ; replace agelefted=FqEndw2 if agelefted==. & FqEndw2!=. ; replace agelefted=FqEndw3 if agelefted==. & FqEndw3!=. ; recode agelefted 2=1 3=2 4=3 5=4 6=5 7=6 8=7 ; label variable agelefted "Age finished full time education" ; label define edlab 1 "Never went to school" 2 "14 or under" 3 "at 15" 4 "at 16" 5 "at 17" 6 "at 18" 7 "19 or over" ; label values agelefted edlab ; /*Highest qualification at wave 1 */ gen highestqual=edqualw1 ; recode highestqual -9=. -8=. -1=. ; label variable highestqual "Highest qualification (wave 1)" ; label define quallab 1 "NVQ4/NVQ5/Degree" 2 "Higher ed below degree" 3 "NVQ3/GCE A level" 4 "NVQ2/GCE O level" 5 "NVQ1/CSE other grade" 6 "Foreign/other" 7 "None" ; label values highestqual quallab ; /*Heights and weights */ /*Recoding -1 to missing for heights and weights at wave 2 nurse visit */ recode htvalw2n -1=. ; recode wtvalw2n -1=. ;