******************************************************************** * File HALCyon PC covariate syntax_NSHD.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 MRC National Survey of Health and Development * Date Created 24/08/2009 * last modified 12/12/2012 * PURPOSE Recodes and derives physical capability variables, basic sociodemographic variables * and covariates (indicators of socioeconomic position, health status, living alone, neuroticism and BMI) for use in cross-cohort analyses ************************************************************************************* # delimit; set more off; /*********************************************************************************/ /*Standard names and categories for demographic variables */ /* SEX */ /*labelling existing sex variable */ label variable sex "Sex of study member" ; label define genderlab 1 "Male" 2 "Female" ; label values sex genderlab ; /*AGE */ /*age at time of assessment not applicable up to 60-64y collection*/ gen age_clinic09=agen09/12 ; label variable age_clinic09 "Age (y) at time of clinic visit" ; gen age_99=age99/12 ; label variable age_99 "Age (y) at time of 1999 home visit" ; /*********************************************************************************/ /* PHYSICAL CAPABILITY MEASURES */ /* GRIP STRENGTH */ /*At age 53y */ /*4 trials performed at age 53y (2 in each hand), using an electronic dynamometer */ /*Best of 4 */ gen bestgrip_53=grip53x ; label variable bestgrip_53 "Grip strength (kg), best of 4, age 53" ; /*At age 60-64y */ /*6 trials performed (2 in each hand), using an electronic dynamometer */ /*Use best of 4 for comparability with age 53y */ gen bestgrip_60=grip4max09 ; replace bestgrip_60=. if grip4max09>776 ; label variable bestgrip_60 "Grip strength (kg), best of 4, age 60-64" ; /* STANDING BALANCE */ /* 2 trials performed at age 53 and then again at age 60-64y - time up to a max of 30s that a person could balance on 1 leg, 1 trial with eyes open, 1 with eyes closed */ /* Age 53y */ /*Eyes open */ gen balance_eo_53=legbp ; label variable balance_eo_53 "Balance time(s), eyes open, 53y" ; /*Eyes closed */ gen balance_ec_53=legbc ; label variable balance_ec_53 "Balance time(s), eyes closed, 53y" ; /*Natural log transformations */ gen lnbalance_eo_53=ln(balance_eo_53) ; label variable lnbalance_eo_53 "ln(Balance time, eyes open), 53y" ; gen lnbalance_ec_53=ln(balance_ec_53) ; label variable lnbalance_ec_53 "ln(Balance time, eyes closed), 53y" ; /*Binary categorisations of 'eyes open' variable */ /*Able to balance for 30s or not */ gen balance_30_eo_53=balance_eo_53 ; recode balance_30_eo_53 (min/29.99=0) (30=1) ; label variable balance_30_eo_53 "Able to balance for 30s eyes open at age 53?" ; label define yeslab 0 "No" 1 "Yes" ; label values balance_30_eo_53 yeslab ; /*Able to complete at least 5 seconds */ gen balance_5_eo_53=balance_eo_53 ; recode balance_5_eo_53 (min/4.99=0) (5/30=1) ; label variable balance_5_eo_53 "Able to balance for at least 5s eyes open? age 53" ; label values balance_5_eo_53 yeslab ; /*Coding balance the alternative way so that inability to balance is the 'positive' outcome */ gen balance_30_eo_opp_53=. ; replace balance_30_eo_opp_53=1 if balance_30_eo_53==0 ; replace balance_30_eo_opp_53=0 if balance_30_eo_53==1 ; label variable balance_30_eo_opp_53 "Able to balance for 30s eyes open? age 53" ; label define nolab 1 "No" 0 "Yes" ; label values balance_30_eo_opp_53 nolab ; gen balance_5_eo_opp_53=. ; replace balance_5_eo_opp_53=1 if balance_5_eo_53==0 ; replace balance_5_eo_opp_53=0 if balance_5_eo_53==1 ; label variable balance_5_eo_opp_53 "Able to balance for at least 5s eyes open? age 53" ; label values balance_5_eo_opp_53 nolab ; /*Creating a categorisation of balance (eyes open) which instead of using a specific time as a cut-point, identifies those in the bottom */ /*20% of performance by sex */ egen bal20m_eo_53=cut(balance_eo_53) if sex==1, group(5) ; egen bal20f_eo_53=cut(balance_eo_53) if sex==2, group(5) ; table bal20m_eo_53, c(min balance_eo_53 max balance_eo_53) ; table bal20f_eo_53, c(min balance_eo_53 max balance_eo_53) ; gen balance_b20_eo_53=. ; replace balance_b20_eo_53=bal20m_eo_53 if sex==1 & bal20m_eo_53!=. ; replace balance_b20_eo_53=bal20f_eo_53 if sex==2 & bal20f_eo_53!=. ; recode balance_b20_eo_53 1/4=0 0=1 ; label variable balance_b20_eo_53 "In bottom 20% of balance times, eyes open, 53" ; label define b20lab 0 "Top 80%" 1 "Bottom 20%" ; label values balance_b20_eo_53 b20lab ; label variable bal20m_eo_53 "Quintiles of balance time, eyes open, men, 53y" ; label variable bal20f_eo_53 "Quintiles of balance time, eyes open, women, 53y" ; /*Binary categorisations of 'eyes closed' variable */ /*Able to balance for 30s or not */ gen balance_30_ec_53=balance_ec_53 ; recode balance_30_ec_53 (min/29.99=0) (30=1) ; label variable balance_30_ec_53 "Able to balance for 30s eyes closed? 53y" ; label values balance_30_ec_53 yeslab ; /*Able to complete at least 5 seconds */ gen balance_5_ec_53=balance_ec_53 ; recode balance_5_ec_53 (min/4.99=0) (5/30=1) ; label variable balance_5_ec_53 "Able to balance for at least 5s eyes closed? 53y" ; label values balance_5_ec_53 yeslab ; /* Age 60-64y */ /*Eyes open */ gen balance_eo_60=legbp09 ; replace balance_eo_60=. if legbp09>776 ; label variable balance_eo_60 "Balance time(s), eyes open, 60-64y" ; /*Eyes closed */ gen balance_ec_60=legbc09 ; replace balance_ec_60=. if legbc09>776 ; label variable balance_ec_60 "Balance time(s), eyes closed, 60-64y" ; /*Natural log transformations */ gen lnbalance_eo_60=ln(balance_eo_60) ; label variable lnbalance_eo_60 "ln(Balance time, eyes open), 60-64y" ; gen lnbalance_ec_60=ln(balance_ec_60) ; label variable lnbalance_ec_60 "ln(Balance time, eyes closed), 60-64y" ; /*Binary categorisations of 'eyes open' variable */ /*Able to balance for 30s or not */ gen balance_30_eo_60=balance_eo_60 ; recode balance_30_eo_60 (min/29.99=0) (30=1) ; label variable balance_30_eo_60 "Able to balance for 30s eyes open at age 60-64?" ; label values balance_30_eo_60 yeslab ; /*Able to complete at least 5 seconds */ gen balance_5_eo_60=balance_eo_60 ; recode balance_5_eo_60 (min/4.99=0) (5/30=1) ; label variable balance_5_eo_60 "Able to balance for at least 5s eyes open? age 60-64" ; label values balance_5_eo_60 yeslab ; /*Coding balance the alternative way so that inability to balance is the 'positive' outcome */ gen balance_30_eo_opp_60=. ; replace balance_30_eo_opp_60=1 if balance_30_eo_60==0 ; replace balance_30_eo_opp_60=0 if balance_30_eo_60==1 ; label variable balance_30_eo_opp_60 "Able to balance for 30s eyes open? age 60-64" ; label values balance_30_eo_opp_60 nolab ; gen balance_5_eo_opp_60=. ; replace balance_5_eo_opp_60=1 if balance_5_eo_60==0 ; replace balance_5_eo_opp_60=0 if balance_5_eo_60==1 ; label variable balance_5_eo_opp_60 "Able to balance for at least 5s eyes open? age 60-64" ; label values balance_5_eo_opp_60 nolab ; /*Creating a categorisation of balance (eyes open) which instead of using a specific time as a cut-point, identifies those in the bottom */ /*20% of performance by sex */ egen bal20m_eo_60=cut(balance_eo_60) if sex==1, group(5) ; egen bal20f_eo_60=cut(balance_eo_60) if sex==2, group(5) ; table bal20m_eo_60, c(min balance_eo_60 max balance_eo_60) ; table bal20f_eo_60, c(min balance_eo_60 max balance_eo_60) ; gen balance_b20_eo_60=. ; replace balance_b20_eo_60=bal20m_eo_60 if sex==1 & bal20m_eo_60!=. ; replace balance_b20_eo_60=bal20f_eo_60 if sex==2 & bal20f_eo_60!=. ; recode balance_b20_eo_60 1/4=0 0=1 ; label variable balance_b20_eo_60 "In bottom 20% of balance times, eyes open, 60-64" ; label values balance_b20_eo_60 b20lab ; label variable bal20m_eo_60 "Quintiles of balance time, eyes open, men, 60-64y" ; label variable bal20f_eo_60 "Quintiles of balance time, eyes open, women, 60-64y" ; /*Binary categorisations of 'eyes closed' variable */ /*Able to balance for 30s or not */ gen balance_30_ec_60=balance_ec_60 ; recode balance_30_ec_60 (min/29.99=0) (30=1) ; label variable balance_30_ec_60 "Able to balance for 30s eyes closed? 60-64y" ; label values balance_30_ec_60 yeslab ; /*Able to complete at least 5 seconds */ gen balance_5_ec_60=balance_ec_60 ; recode balance_5_ec_60 (min/4.99=0) (5/30=1) ; label variable balance_5_ec_60 "Able to balance for at least 5s eyes closed? 60-64y" ; label values balance_5_ec_60 yeslab ; /*CHAIR RISES */ /*1 trial of 10 chair rises at age 53y */ gen chairtime_53=chrstfc ; label variable chairtime_53 "Chair rise time (s), 10 rises, age 53" ; /*coding to missing people with values <1s per chair rise */ replace chairtime_53=. if chairtime_53<10 ; /*Natural log transformation */ gen lnchairtime_53=ln(chairtime_53) ; label variable lnchairtime_53 "ln(chair rise time, age 53)" ; /*Reciprocal of chair rise time */ gen rpchairtime_53=(1/chairtime_53)*100 ; label variable rpchairtime_53 "Reciprocal of chair rise time, age 53" ; /*Chair rise speed */ /*Chair rises per second */ gen chairspeed53_s=10/chairtime_53 ; label variable chairspeed53_s "Chair rise speed (stands/sec), 53y" ; /*per minute */ gen chairspeed53_m=chairspeed53_s*60 ; label variable chairspeed53_m "Chair rise speed (stands/min), 53y" ; /* Rebecca's conversion of 10 chair rises to 5 chair rises - using ELSA 50-59 years sex specific data*/ gen estchairtime5_53=. ; replace estchairtime5_53=0.51+0.46*chrstfc if sex==1 & chrstfc!=. ; replace estchairtime5_53=0.63+0.44*chrstfc if sex==2 & chrstfc!=. ; label variable estchairtime5_53 "Estimated chair rise time for 5 rises, age 53" ; /*coding to missing people with values <1s per chair rise */ replace estchairtime5_53=. if estchairtime5_53<5 ; /*Natural log transformation */ gen lnchairtime5_53=ln(estchairtime5_53) ; label variable lnchairtime5_53 "ln(chair rise time (estimate for 5 rises), age 53)" ; /*1 trial of 10 chair rises at age 60-64y */ gen chairtime_60=chrst09 ; replace chairtime_60=. if chrst09>776 ; label variable chairtime_60 "Chair rise time (s), 10 rises, age 60-64" ; /*coding to missing people with values <1s per chair rise */ replace chairtime_60=. if chairtime_60<10 ; /*Natural log transformation */ gen lnchairtime_60=ln(chairtime_60) ; label variable lnchairtime_60 "ln(chair rise time, age 60-64)" ; /*Reciprocal of chair rise time */ gen rpchairtime_60=(1/chairtime_60)*100 ; label variable rpchairtime_60 "Reciprocal of chair rise time, age 60-64" ; /*Chair rise speed */ /*Chair rises per second */ gen chairspeed60_s=10/chairtime_60 ; label variable chairspeed60_s "Chair rise speed (stands/sec), 60-4y" ; /*per minute */ gen chairspeed60_m=chairspeed60_s*60 ; label variable chairspeed60_m "Chair rise speed (stands/min), 60-4y" ; /* Rebecca's conversion of 10 chair rises to 5 chair rises - using ELSA 50-59 years sex specific data*/ gen estchairtime5_60=. ; replace estchairtime5_60=0.51+0.46*chairtime_60 if sex==1 & chairtime_60!=. ; replace estchairtime5_60=0.63+0.44*chairtime_60 if sex==2 & chairtime_60!=. ; label variable estchairtime5_60 "Estimated chair rise time for 5 rises, age 60-64" ; /*coding to missing people with values <1s per chair rise */ replace estchairtime5_60=. if estchairtime5_60<5 ; /*Natural log transformation */ gen lnchairtime5_60=ln(estchairtime5_60) ; label variable lnchairtime5_60 "ln(chair rise time (estimate for 5 rises), age 60-64)" ; /*TUG speed at 60 */ gen tugspeed_60=tugspeed09 ; replace tugspeed_60=. if tugspeed09>776 ; label variable tugspeed_60 "TUG speed (m/s), 60-64y" ; /*Unables at 53*/ gen gripunable_53=. ; replace gripunable_53=1 if grip53g==996 ; replace gripunable_53=0 if grip53g==1 ; label variable gripunable_53 "Unable to perform grip test? age 53y" ; label define unablelab 0 "Able" 1 "Unable" ; label values gripunable_53 unablelab ; gen chairunable_53=. ; replace chairunable_53=1 if chrst53g==995 | chrst53g==997 ; replace chairunable_53=0 if chrst53g==1 ; label variable chairunable_53 "Unable to perform chair rise test? age 53y" ; label values chairunable_53 unablelab ; /***************************************************************************************/ /*SOCIOECONOMIC POSITION */ /*Childhood SEP */ /*Occupational class of male head of household at age 4y */ gen occ_fath_4=fsc50t ; /*coding to missing those unclassified (incl missing) */ recode occ_fath_4 66=. 99=. ; label variable occ_fath_4 "Father's occupation at age 4y" ; label define seplab 1 "I" 2 "II" 3 "IIINM" 4 "IIIM" 5 "IV" 6 "V" ; label values occ_fath_4 seplab ; /*Adult SEP */ /*Own occupational class in adulthood -taking information from age 53 if available, from 43 if not and so on */ gen occ_adult_own=sc1553 ; recode occ_adult_own 999=. ; label variable occ_adult_own "Own adult occupational class (53-15)" ; label values occ_adult_own seplab ; /*Binary categorisation in line with other studies */ gen occ_adult_2cat=occ_adult_own ; recode occ_adult_2cat 1/2=1 3/6=2 ; label variable occ_adult_2cat "Adult occupational class (binary)" ; label define occcatlab 1 "I or II" 2 "III, IV or V" ; label values occ_adult_2cat occcatlab ; /*Occupational class in adulthood of spouse in adulthood (53-15)*/ gen occ_adult_sp=spsc1553 ; recode occ_adult_sp 999=. ; label variable occ_adult_sp "Spouse adult occupational class (53-15)" ; label values occ_adult_sp seplab ; /*Education variables */ gen highestqual=lhqr ; recode highestqual 0=0 1=1 2=1 3=2 4=3 5=3 6/8=4 88=. 99=. ; label variable highestqual "Highest qualification achieved" ; label define edulab 0 "None" 1 "Sub GCE or vocational course" 2 "GCE O level or Burnham C" 3 "GCE 'A' level, Burnham B or Burnham A2" 4 "Degree or higher" ; label values highestqual edulab ; /*Binary categorisation as per other cohorts */ gen highestqual_2cat=highestqual ; recode highestqual_2cat 0/2=1 3/4=2 ; label define quallab 1 "O level or lower" 2 "A level or higher" ; label values highestqual_2cat quallab ; /*OTHER COVARIATES */ /*Neuroticism */ /*Recoding missing values to . for neuroticism at age 26y */ recode neur72 19=. ; /*Living alone */ /*Creating a variable to identify people living alone at baseline based on their marital status at age 53y (need to check that this is best measure) */ gen livealn=. ; replace livealn=1 if marstats==1 | marstats==3 | marstats==4 | marstats==5 ; replace livealn=2 if marstats==2 ; label define alonelab 1 "Living alone" 2 "Not living alone" ; label values livealn alonelab ; /*Height, weight and BMI */ /*Recoding missing values to . for height and weight at age 53y */ recode ht99u 7777=. 9997=. 9999=. ; recode wt99u 7777=. 9997=. 9999=. ; recode bmi99u 7777=. 9997=. 9999=. ; /*Health status */ /*Health status (renaming it to be consistent with other cohort analyses) */ gen hp_w1=hp99l1 ; recode hp_w1 8=. ; label variable hp_w1 "Health status" ; label define hplab 0 "No" 1 "Yes" ; label values hp_w1 hplab ;