******************************************************************** * File HALCyon PC covariate syntax_HAS.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 Hertfordshire Ageing Study (HAS) * Date Created 19/08/2009 * last modified 02/04/2012 * PURPOSE Recodes and derives physical capability variables, basic sociodemographic variables * and indicators of socioeconomic position for use in cross-cohort analyses ************************************************************************************* # delimit; set more off; /*Creating break between newly recoded variables and variables in existing dataset with a blank variable */ gen recodes_below=. ; /*Taking 1994-5 assessment to be wave 1 */ /*Taking 2003-5 assessment to be wave 2 */ /*********************************************************************************/ /*Standard names and categories for demographic variables */ /* SEX */ /*variable already available - sex 1=men 2=women */ /*AGE */ gen age_w1=intage ; gen age_w2=hage ; label variable age_w1 "Age at wave 1 (94/5 assessment)" ; label variable age_w2 "Age at wave 2 (03/05 assessment)" ; /*Categories of age at time of wave 1 assessment (range 63-73) */ /*in 10 year age groups 60-69, 70-79 */ gen agecat_w1=age_w1 ; recode agecat_w1 (min/69.999=1) (70/79.999=2) (80/89.999=3) ; label variable agecat_w1 "Age at wave 1 (10y cat.)" ; label define agelab 1 "60-69" 2 "70-79" 3 "80+" ; label values agecat_w1 agelab ; /*in 5 year age groups 60-64, 65-69, 70-74, 75-79, 80-84 years */ gen agecat5_w1=age_w1 ; recode agecat5_w1 (min/64.999=1) (65/69.999=2) (70/74.999=3) (75/79.999=4) (80/84.999=5) ; label variable agecat5_w1 "Age at wave 1 (5y cat.)" ; label define age5lab 1 "60-64" 2 "65-69" 3 "70-74" 4 "75-79" 5 "80+" ; label values agecat5_w1 age5lab ; /*Categories of age at time of wave 2 assessment (range 72-83) */ /*in 10 year age groups 60-69, 70-79, 80-89 */ gen agecat_w2=age_w2 ; recode agecat_w2 (min/69.999=1) (70/79.999=2) (80/89.999=3) ; label variable agecat_w2 "Age at wave 2 (10y cat.)" ; label values agecat_w2 agelab ; /*in 5 year age groups 60-64, 65-69, 70-74, 75-79, 80-84 years */ gen agecat5_w2=age_w2 ; recode agecat5_w2 (min/64.999=1) (65/69.999=2) (70/74.999=3) (75/79.999=4) (80/84.999=5) ; label variable agecat5_w2 "Age at wave 2 (5y cat.)" ; label values agecat5_w2 age5lab ; /*********************************************************************************/ /* PHYSICAL CAPABILITY MEASURES */ /* GRIP STRENGTH */ /*6 trials performed at both waves, at wave 1 using an Harpenden dynamometer and at wave 2 using a Jamar dynamometer */ /* Wave 1 */ /*provided with measure which is best of 6 and also each individual measure */ /*RH checked and best measure has been derived as expected so no need to derive again */ gen bestgrip_w1=bestgrip ; label variable bestgrip_w1 "Grip strength (kg), best of 6, wave 1" ; /*Average grip strength */ egen gripmissing_w1=rmiss(gripr1-gripl3) ; label variable gripmissing_w1 "No. of missing grip values, wave 1" ; egen griptot_w1=rsum(gripr1-gripl3) if gripmissing_w1>=0 & gripmissing_w1<6 ; label variable griptot_w1 "Sum of grip values, wave 1" ; gen avgrip_w1=. ; replace avgrip_w1=griptot_w1/6 if gripmissing_w1==0 ; replace avgrip_w1=griptot_w1/5 if gripmissing_w1==1 ; replace avgrip_w1=griptot_w1/4 if gripmissing_w1==2 ; replace avgrip_w1=griptot_w1/3 if gripmissing_w1==3 ; replace avgrip_w1=griptot_w1/2 if gripmissing_w1==4 ; replace avgrip_w1=griptot_w1 if gripmissing_w1==5 ; label variable avgrip_w1 "Average grip strength (kg), wave 1" ; /* Wave 2 */ /*provided with measure which is best of 6, also best from each hand and all 6 individual measures */ /*RH checked and best measure has been derived as expected so no need to derive again */ gen bestgrip_w2=amaxgrip ; label variable bestgrip_w2 "Grip strength (kg), best of 6, wave 2" ; /*Average grip strength */ egen gripmissing_w2=rmiss(agripr1-agripl3) ; label variable gripmissing_w2 "No. of missing grip values, wave 2" ; egen griptot_w2=rsum(agripr1-agripl3) if gripmissing_w2>=0 & gripmissing_w2<6 ; label variable griptot_w2 "Sum of grip values, wave 2" ; gen avgrip_w2=. ; replace avgrip_w2=griptot_w2/6 if gripmissing_w2==0 ; replace avgrip_w2=griptot_w2/5 if gripmissing_w2==1 ; replace avgrip_w2=griptot_w2/4 if gripmissing_w2==2 ; replace avgrip_w2=griptot_w2/3 if gripmissing_w2==3 ; replace avgrip_w2=griptot_w2/2 if gripmissing_w2==4 ; replace avgrip_w2=griptot_w2 if gripmissing_w2==5 ; label variable avgrip_w2 "Average grip strength (kg), wave 2" ; /* STANDING BALANCE */ /*1 trial performed at wave 2 */ gen balance_w2=fstime ; label variable balance_w2 "Balance time(s), wave 2" ; /*INCLUDING THOSE 16 PEOPLE UNABLE TO BALANCE IN 'UNABLE CATEGORY' */ /*Binary categorisations of balance time variable */ /*Able to balance for 30s or not */ gen balance_30_w2=balance_w2 ; recode balance_30_w2 (min/29.99=0) (30=1) ; replace balance_30_w2=0 if fsdone==0 ; label variable balance_30_w2 "Able to balance for 30s?" ; label define yeslab 0 "No" 1 "Yes" ; label values balance_30_w2 yeslab ; /*Able to complete at least 5 seconds */ gen balance_5_w2=balance_w2 ; recode balance_5_w2 (min/4.99=0) (5/30=1) ; replace balance_5_w2=0 if fsdone==0 ; label variable balance_5_w2 "Able to balance for at least 5s?" ; label values balance_5_w2 yeslab ; /*Coding balance the alternative way so that inability to balance is the 'positive' outcome */ gen balance_5_w2_opp=. ; replace balance_5_w2_opp=1 if balance_5_w2==0 ; replace balance_5_w2_opp=0 if balance_5_w2==1 ; label variable balance_5_w2_opp "Able to balance for at least 5s?" ; label define nolab 1 "No" 0 "Yes" ; label values balance_5_w2_opp nolab ; gen balance_30_w2_opp=. ; replace balance_30_w2_opp=1 if balance_30_w2==0 ; replace balance_30_w2_opp=0 if balance_30_w2==1 ; label variable balance_30_w2_opp "Able to balance for 30s?" ; label values balance_30_w2_opp nolab ; /*Creating a categorisation of balance which instead of using a specific time as a cut-point, identifies those in the bottom */ /*20% of performance by sex */ /*first adding unables to time variable */ gen balanceun_w2=balance_w2 ; replace balanceun_w2=0 if fsdone==0 ; egen bal20m=cut(balanceun_w2) if sex==1, group(5) ; egen bal20f=cut(balanceun_w2) if sex==2, group(5) ; table bal20m, c(min balanceun_w2 max balanceun_w2) ; table bal20f, c(min balanceun_w2 max balanceun_w2) ; drop balanceun_w2 ; gen balance_b20_w2=. ; replace balance_b20_w2=bal20m if sex==1 & bal20m!=. ; replace balance_b20_w2=bal20f if sex==2 & bal20f!=. ; recode balance_b20_w2 1/4=0 0=1 ; label variable balance_b20_w2 "In bottom 20% of balance times, wave 2" ; label define b20lab 0 "Top 80%" 1 "Bottom 20%" ; label values balance_b20_w2 b20lab ; label variable bal20m "Quintiles of balance time, men" ; label variable bal20f "Quintiles of balance time, women" ; /*TIMED GET UP AND GO */ /* 1 trial performed at wave 2 - time taken in seconds to get up from a chair, walk a distance of 3m at usual pace, turn on touching line */ /* return to chair and sit back down again */ gen tugtime_w2=tu6mupgo ; label variable tugtime_w2 "TUG time (s), wave 2" ; /*Natural log transformation */ gen lntugtime_w2=ln(tugtime_w2) ; label variable lntugtime_w2 "ln(TUG time)" ; /*Calculation of timed get up and go speed (assuming all time is spent walking the 6m which is not entirely correct) */ gen tugspeed_w2=6/tugtime_w2 ; label variable tugspeed_w2 "TUG speed (m/s), wave 2" ; /*WALKING TIME AND SPEED */ /*1 trial of time taken to walk 3m completed at wave 2 */ gen walktime_w2=tu3mwlk ; label variable walktime_w2 "Time to walk 3m (s), wave 2"; /*Using walking time to calculate walking speed in m/s */ gen walkspeed_w2=3/walktime_w2 ; label variable walkspeed_w2 "Walking speed (m/s), wave 2" ; /*CHAIR RISES */ /*1 trial of 5 chair rises at wave 2 */ /*exclude those who did not complete 5 chair rises (n=7) in creating variable */ gen chairtime_w2=crtime if crfive==1 ; label variable chairtime_w2 "Chair rise time (s), 5 rises, wave 2" ; /*Natural log transformation */ gen lnchairtime_w2=ln(chairtime_w2) ; label variable lnchairtime_w2 "ln(chair rise time)" ; /*Reciprocal */ gen rpchairtime_w2=(1/chairtime_w2)*100 ; label variable rpchairtime_w2 "Reciprocal of chair rise time, wave 2" ; /*Unable variables */ gen unablechair=. ; /*Unable to do chair rises (health reasons given within crwhynot and crwhyrs variables */ replace unablechair=1 if crwhynot==1 | crwhynot==2 ; /*Unable to do chair rises - attempted, but failed to complete 5 */ replace unablechair=1 if crdone==1 & chairtime_w2==. ; /*successfully completed chair rises */ replace unablechair=0 if chairtime_w2!=. ; /*For balance fsdone can be used to identify those unable */ /***************************************************************************************/ /*SOCIOECONOMIC POSITION */ /*Childhood SEP */ /*Father's occupational class - ascertained in 1994-5 questionnaire */ gen occ_fath=soccfath ; /*recoding so that all values are whole integers */ recode occ_fath 1=1 2=2 5=6 4=5 3.2=4 3.1=3 ; label variable occ_fath "Father's occupation" ; label define seplab 1 "I" 2" II" 3 "IIINM" 4 "IIIM" 5 "IV" 6 "V" ; label values occ_fath seplab ; /*Adult SEP */ /*Own occupational class in adulthood - from 1994-5 questionnaire */ gen occ_adult_own=soccself ; /*recoding so that all values are whole integers */ recode occ_adult_own 1=1 2=2 5=6 4=5 3.2=4 3.1=3 ; label variable occ_adult_own "Own adult occupational class" ; label values occ_adult_own seplab ; /*Occupational class in adulthood of self for men and never married women and of husband for ever married women - from 1994-5 questionnaire */ gen occ_adult_hh=socclass ; /*recoding so that all values are whole integers */ recode occ_adult_hh 1=1 2=2 5=6 4=5 3.2=4 3.1=3 ; label variable occ_adult_hh "Head of house adult occupational class" ; label values occ_adult_hh seplab ; /*Education variables */ /*Age at leaving full-time education - ascertained in 2003-5 HHQ */ gen agelefted=hendedu ; label variable agelefted "Age at leaving full-time ed (y)" ; /*Any qualifications? */ gen qual=wbqual ; label variable qual "Any qualifications?" ; label values qual yeslab ; /*Other variables on income etc, no. of years retired, available resources, qualifications but N low as taken from 2003-5 wellbeing questionnaire */