******************************************************************** * File HALCyon body size syntax_BoydOrr.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 Boyd Orr cohort study * Date Created 12/05/2010 * last modified 15/07/2010 * PURPOSE Recodes and derives body size variables for use in cross-cohort analyses ************************************************************************************* # delimit; set more off; /*BMI and height at wave 3*/ gen bmi_w3=b3bmi_combined ; label variable bmi_w3 "Body mass index (kg/m2) at wave 3" ; gen ht_w3=b3height_combined/10 ; label variable ht_w3 "Height (cm) at wave 3" ; /*birth weight*/ gen bwtkg=b2birthweight_combined ; label variable bwtkg "Birth weight (kg)" ; /*recalled height and weight at 20 years*/ mvdecode heightfeet heightinches height20feet height20inches weightstones weightpounds var1 var2 var3 var4, mv(99) ; gen ht20=(height20feet*12)+height20inches ; gen ht20cm=ht20*2.54 ; label variable ht20cm "Height at age 20 years (cm)" ; gen wt20=(var1*14)+var2 ; gen wt20kg=wt20*0.454 ; label variable wt20kg "Weight at age 20 years (kg)" ; gen bmi20=wt20kg/((ht20cm/100)^2) ; label variable bmi20 "BMI at age 20 years (kg/m2)" ; /*recalled height and weight at 40 years*/ by sex, sort: summ var3 var4, d ; gen wt40=(var3*14)+var4 ; gen wt40kg=wt40*0.454 ; label variable wt40kg "Weight at age 40 years (kg)" ; gen bmi40=wt40kg/((ht20cm/100)^2) ; label variable bmi40 "BMI at age 40 years (kg/m2)" ; /*body size at wave 2*/ mvdecode heightfeet heightinches, mv(99) ; by sex, sort: summ b2height_self b2bmi_self heightfeet heightinches, d ; gen b2heightcm=b2height_self/10 ; gen height_check=((heightfeet*12)+heightinches)*2.54 ; gen weight_check=((weightstones*14)+weightpounds)*0.454 ; gen BMI_check=(weight_check)/((height_check/100)^2) ; gen b2weight=(b2bmi_self)*((b2heightcm/100)^2) ; /*compute z-scores*/ egen bmi20m=std(bmi20) if sex==1 ; egen bmi20f=std(bmi20) if sex==2 ; gen bmi20z=. ; replace bmi20z=bmi20m if sex==1 ; replace bmi20z=bmi20f if sex==2 ; egen bmi40m=std(bmi40) if sex==1 ; egen bmi40f=std(bmi40) if sex==2 ; gen bmi40z=. ; replace bmi40z=bmi40m if sex==1 ; replace bmi40z=bmi40f if sex==2 ; egen bmi_w2m=std(b2bmi_self) if sex==1 ; egen bmi_w2f=std(b2bmi_self) if sex==2 ; gen bmi_w2z=. ; replace bmi_w2z=bmi_w2m if sex==1 ; replace bmi_w2z=bmi_w2f if sex==2 ; /*compute velocities*/ gen bmi2040=(bmi40-bmi20)/20 ; egen bmi2040m=std(bmi2040) if sex==1 ; egen bmi2040f=std(bmi2040) if sex==2 ; gen bmi2040z=. ; replace bmi2040z=bmi2040m if sex==1 ; replace bmi2040z=bmi2040f if sex==2 ; gen bmi40c=(bmi_w3-bmi40)/(age_w3-40) ; egen bmi40cm=std(bmi40c) if sex==1 ; egen bmi40cf=std(bmi40c) if sex==2 ; gen bmi40cz=. ; replace bmi40cz=bmi40cm if sex==1 ; replace bmi40cz=bmi40cf if sex==2 ; /*wave 2 approximately five years prior to wave 3*/ gen bmi40w2=(b2bmi_self-bmi40)/((age_w3-5)-40) ; egen bmi40w2m=std(bmi40w2) if sex==1 ; egen bmi40w2f=std(bmi40w2) if sex==2 ; gen bmi40w2z=. ; replace bmi40w2z=bmi40w2m if sex==1 ; replace bmi40w2z=bmi40w2f if sex==2 ; gen bmiw2c=(bmi_w3-b2bmi_self)/5 ; egen bmiw2cm=std(bmiw2c) if sex==1 ; egen bmiw2cf=std(bmiw2c) if sex==2 ; gen bmiw2cz=. ; replace bmiw2cz=bmiw2cm if sex==1 ; replace bmiw2cz=bmiw2cf if sex==2 ;