sysdir * Install ado files /*ssc install asdoc ssc install distinct ssc install esttab ssc install isvar ssc install mdesc ssc install table1_mc*/ *********************************************************************************************************************************************************** * Data preparation steps * Step 0: Define directories * Step 1: Extracting variables from all the individual-related files and create individual specific wave-files * Step 2: Appending all the files wave from indresp into one long format file long and rename and recode variables and restrict (age>50) * Step 3: Appending all the other individual wave files from individualall + individualsamp + xwavedat into one long format file * Step 4: Appending all the created long individual files together: individualresp + individualall + xwavedat (individualsamp not used at the moment) * Step 5: Checking the created long individual file and create the death variable * Step 6: Extracting variables from the household files and create household specific wave-files * Step 7: Appending household datasets into long format file: household level from several waves * Step 8: Merging and combining household level and individual level files + mergin BHPS + descriptive statics before mvdecode * Step 9: Using mvdecode for missings and recoding before FI * Step 10:Hcond updating calculation * Step 11:Calculation of the Frailty index FI and possible alternatives and sample selection (line 4884) ********************************************************************************************************************************************************** * Step 0 version 18 clear set more off capture log close * /* Paths have to be adapted by other user*/ /*cd "C:\ukhls" global estimation "C:\...\estimation" global graphs "C:\...\graphs" global inpath "C:" global outpath "...." global tables "C:\...\tables"*/ *log using "$outpath\Understanding Society_Frailty Index_date.log", replace clear matrix clear mata clear all set maxvar 9000 set matsize 10000 clear set more off clear matrix clear mata clear all set maxvar 9000 set matsize 10000 * Controlling output permanently set cformat %9.3f, permanently set pformat %5.3f, permanently set sformat %8.3f, permanently ******************************************************************************************************************************* * COMBINING INDIVIDUAL DATASETS INTO LONG FORMAT:INDIVIDUAL LEVEL AND SEVERVAL WAVES ******************************************************************************** * Step 1a * Using files indresp (indivudual respondent information) foreach w in a b c d e f g h i j k l m { // the commands between the curly breakets are executed for each element of // w (i.e., a b c d e f g h i j k l) in repeated iterations // In the 1st iteration Stata reads `w' as a, // In the 2nd-nth iteration Stata reads `w' as b, c and so on // (i) Extract the variables needed * first identifier variables pidp hidp * `w'_var* in alphabetical order use "$inpath/ukhls/`w'_indresp", clear #delimit ; isvar pidp `w'_hidp `w'_adla `w'_adlb `w'_adlc `w'_adld `w'_adle `w'_adlf `w'_adlg `w'_adlh `w'_adli `w'_adlj `w'_adlk `w'_adll `w'_adlm `w'_adln `w'_adlad `w'_adlbd `w'_adlcd `w'_adldd `w'_adled `w'_adlfd `w'_adlgd `w'_adlhd `w'_adlid `w'_adljd `w'_adlkd `w'_adlld `w'_adlmd `w'_adlnd `w'_age_dv `w'auditc1 `w'_bmi_dv `w'_cohab_dv `w'_country `w'_cvhlthlink `w'_disdif1 `w'_disdif2 `w'_disdif3 `w'_disdif4 `w'_disdif5 `w'_disdif6 `w'_disdif7 `w'_disdif8 `w'_disdif9 `w'_disdif10 `w'_disdif11 `w'_disdif12 `w'_disdif96 `w'_dissev8 `w'_dobm_dv w'_doby_dv `w'_drgmj `w'_drgoth `w'_drgsol `w'_esex `w'_ethn_dv `w'_ff_ivlolw `w'_ff_everint /* mc age told had health condition: w1-w12*/ `w'_hconda01 `w'_hconda02 `w'_hconda03 `w'_hconda04 `w'_hconda05 `w'_hconda06 `w'_hconda07 `w'_hconda08 `w'_hconda09 `w'_hconda10 `w'_hconda11 `w'_hconda12 `w'_hconda13 `w'_hconda14 `w'_hconda15 `w'_hconda16 `w'_hconda17 `w'_hconda19 `w'_hconda20 `w'_hconda21 `w'_hconda23 `w'_hconda24 `w'_hconda26 `w'_hconda27 `w'_hconda28 `w'_hconda29 `w'_hconda30 `w'_hconda31 `w'_hconda33 `w'_hconda34 `w'_hconda35 `w'_hconda37 `w'_hconda38 `w'_hconda39 `w'_hconda40 `w'_hconda41 `w'_hconda42 /*Only hcondna1-hcondna13 existing */ `w'_hcondna1 `w'_hcondna2 `w'_hcondna3 `w'_hcondna4 `w'_hcondna5 `w'_hcondna6 `w'_hcondna7 `w'_hcondna8 `w'_hcondna9 `w'_hcondna10 `w'_hcondna11 `w'_hcondna12 `w'_hcondna13 `w'_hcondna14 `w'_hcondna15 `w'_hcondna16 `w'_hcondna17 `w'_hcondna18 `w'_hcondna19 `w'_hcondna20 `w'_hcondna21 `w'_hcondna22 `w'_hcondna23 `w'_hcondna24 `w'_hcondna25 `w'_hcondna26 `w'_hcondna27 `w'_hcondna28 `w'_hcondna29 `w'_hcondna30 `w'_hcondna31 `w'_hcondna32 `w'_hcondna33 `w'_hcondna34 `w'_hcondna35 `w'_hcondna36 /* health condition w1-w12 */ `w'_hcond1 `w'_hcond2 `w'_hcond3 `w'_hcond4 `w'_hcond5 `w'_hcond6 `w'_hcond7 `w'_hcond8 `w'_hcond9 `w'_hcond10 `w'_hcond11 `w'_hcond12 `w'_hcond13 `w'_hcond14 `w'_hcond15 `w'_hcond16 `w'_hcond17 `w'_hcond19 `w'_hcond20 `w'_hcond21 `w'_hcond22 `w'_hcond26 `w'_hcond27 `w'_hcond28 `w'_hcond29 `w'_hcond30 `w'_hcond31 `w'_hcond32 `w'_hcond33 `w'_hcond34 `w'_hcond35 `w'_hcond36 `w'_hcond96 `w'_hcond97 /*health condition: w10-w12ff*/ `w'_hcondcode1 `w'_hcondcode2 `w'_hcondcode3 `w'_hcondcode4 `w'_hcondcode5 `w'_hcondcode6 `w'_hcondcode7 `w'_hcondcode8 `w'_hcondcode9 `w'_hcondcode10 `w'_hcondcode11 `w'_hcondcode12 `w'_hcondcode13 `w'_hcondcode14 `w'_hcondcode15 `w'_hcondcode16 `w'_hcondcode19 `w'_hcondcode20 `w'_hcondcode21 `w'_hcondcode22 `w'_hcondcode23 `w'_hcondcode24 `w'_hcondcode25 `w'_hcondcode26 `w'_hcondcode27 `w'_hcondcode28 `w'_hcondcode29 `w'_hcondcode30 `w'_hcondcode31 `w'_hcondcode32 `w'_hcondcode33 `w'_hcondcode34 `w'_hcondcode35 `w'_hcondcode36 `w'_hcondcode43 `w'_hcondcode96 `w'_hcondcode97 /*ever had health condition in w3: heart attack or myocardial infarction, stroke, none of these in w3 */ `w'_hconde6 `w'_hconde7 `w'_hconde96 /*age told first had heart attack or myocardial infarction in w3 */ `w'_hcondea6 `w'_hcondea7 /*ever had health condition in w10: */ `w'_hcondever1 `w'_hcondever2 `w'_hcondever3 `w'_hcondever4 `w'_hcondever5 `w'_hcondever6 `w'_hcondever7 `w'_hcondever8 `w'_hcondever10 `w'_hcondever11 `w'_hcondever12 `w'_hcondever13 `w'_hcondever14 `w'_hcondever15 `w'_hcondever16 `w'_hcondever19 `w'_hcondever20 `w'_hcondever21 `w'_hcondever22 `w'_hcondever96 `w'_hcondever97 /* hcond in waves2-w9: new and not existing `w'_hconde97*/ `w'_hcondn1 `w'_hcondn2 `w'_hcondn3 `w'_hcondn4 `w'_hcondn5 `w'_hcondn6 `w'_hcondn7 `w'_hcondn8 `w'_hcondn9 `w'_hcondn10 `w'_hcondn11 `w'_hcondn12 `w'_hcondn13 `w'_hcondn14 `w'_hcondn15 `w'_hcondn16 `w'_hcondn17 `w'_hcondn18 `w'_hcondn19 `w'_hcondn20 /*`w'_hcondn21*/ `w'_hcondn23 `w'_hcondn24 `w'_hcondn25 `w'_hcondn96 /* hcond in w10-w12 - `w'_hcondncode22*/ `w'_hcondncode1 `w'_hcondncode2 `w'_hcondncode3 `w'_hcondncode4 `w'_hcondncode5 `w'_hcondncode6 `w'_hcondncode7 `w'_hcondncode8 `w'_hcondncode10 `w'_hcondncode11 `w'_hcondncode12 `w'_hcondncode14 `w'_hcondncode15 `w'_hcondncode16 `w'_hcondncode19 `w'_hcondncode20 `w'_hcondncode21 `w'_hcondncode22 `w'_hcondncode23 `w'_hcondncode24 `w'_hcondncode25 `w'_hcondncode26 `w'_hcondncode27 `w'_hcondncode28 `w'_hcondncode29 `w'_hcondncode30 `w'_hcondncode31 `w'_hcondncode32 `w'_hcondncode33 `w'_hcondncode34 `w'_hcondncode35 `w'_hcondncode36 `w'_hcondncode37 `w'_hcondncode38 `w'_hcondncode39 `w'_hcondncode40 `w'_hcondncode41 `w'_hcondncode42 `w'_hcondncode43 `w'_hcondncode96 `w'_hcondncode97 /*: hcond in w11-w12: : new not existing `w'_hconde97*/ `w'_hcondnew1 `w'_hcondnew2 `w'_hcondnew3 `w'_hcondnew4 `w'_hcondnew5 `w'_hcondnew6 `w'_hcondnew7 `w'_hcondnew8 `w'_hcondnew10 `w'_hcondnew11 `w'_hcondnew12 `w'_hcondnew13 `w'_hcondnew14 `w'_hcondnew15 `w'_hcondnew16 `w'_hcondnew19 `w'_hcondnew20 `w'_hcondnew21 `w'_hcondnew22 `w'_hcondnew96 `w'_hcondnew97 `w'_hcondno1 `w'_hcondno2 `w'_hcondno3 `w'_hcondno4 `w'_hcondno5 `w'_hcondno6 `w'_hcondno7 `w'_hcondno8 `w'_hcondno9 `w'_hcondno10 `w'_hcondno11 `w'_hcondno12 `w'_hcondno13 `w'_hcondns1 `w'_hcondns2 `w'_hcondns3 `w'_hcondns4 `w'_hcondns5 `w'_hcondns6 `w'_hcondns7 `w'_hcondns8 `w'_hcondns9 `w'_hcondns10 `w'_hcondns11 `w'_hcondns12 `w'_hcondns13 /* still have health conditions for new entrants*/ `w'_hconds01 `w'_hconds02 `w'_hconds03 `w'_hconds04 `w'_hconds05 `w'_hconds06 `w'_hconds07 `w'_hconds08 `w'_hconds09 `w'_hconds10 `w'_hconds11 `w'_hconds12 `w'_hconds13 `w'_hconds14 `w'_hconds15 `w'_hconds16 `w'_hconds17 `w'_hconds21 `w'_hconds22 `w'_hconds23 `w'_hconds24 `w'_hconds25 `w'_hconds26 `w'_hconds27 `w'_hconds28 `w'_hconds29 `w'_hconds30 `w'_hconds31 `w'_hconds32 `w'_hconds33 `w'_hconds34 `w'_hconds35 `w'_hconds36 `w'_hconds37 `w'_hconds38 `w'_hconds39 `w'_hconds40 `w'_hconds41 `w'_hconds42 `w'_hconds43 `w'_hconds96 `w'_hconds97 /* long-standing illness or impairment*/ `w'_health `w'_hl2hop `w'_hl2gp `w'_hospc1 `w'_hospd `w'_hospdc1 `w'_hhorig `w'_indinus_lw `w'_indinus_xw `w'_indmode `w'_iproxy `w'_indscub_lw `w'_indscui_lw `w'_indscus_lw `w'_ivaffct15 `w'_istrtdaty `w'_ivfio `w'_jbendreas7 `w'_jbnssec3 `w'_jbnssec_dv `w'_jbstat `w'_memorig `w'_mastat_dv `w'_mhealthtyp2 `w'_mabroad `w'_mnabroad `w'_mindirect `w'_mnotherc `w'_mreturned `w'_mlived `w'_mnlived `w'_moveage `w'_ncigs `w'_qfhigh_dv `w'_qfhighfl_dv `w'_racel_dv `w'_scac `w'_scdata_dv `w'_scflag_dv `w'_sclonely `w'_scghq1_dv `w'_scghq2_dv `w'_scghqa `w'_scghqb `w'_scghqc `w'_scghqd `w'_scghqe `w'_scghqf `w'_scghqg `w'_scghqh `w'_scghqi `w'_scghqj `w'_scghqk `w'_scghql `w'_schrs_slph `w'_schrs_slpm `w'_sclfsato `w'_sclfsat1 `w'_scsf1 `w'_scsf2a `w'_scsf2b `w'_scsf3a `w'_scsf3b `w'_scsf4a `w'_scsf4b `w'_scsf5 `w'_scsf6a `w'_scsf6b `w'_scsf6c `w'_scsf7 `w'_sctslp_30m `w'_sctslp_wak `w'_sctslp_cgh `w'_scmed_slp `w'_sctsta_awk `w'_scslp_qual `w'_scun1 `w'_scun2 `w'_scun3 `w'_scun97 `w'_sf1 `w'_sf2a `w'_sf2b `w'_sf3a `w'_sf3b `w'_sf4a `w'_sf4b `w'_sf5 `w'_sf6a `w'_sf6b `w'_sf6c `w'_sf7 `w'_sf12mcs_dv `w'_sf12pcs_dv `w'_sex_dv `w'_symptoms8 w'_symptoms20 `w'_tslp_wak `w'_tsta_awk `w'_urban_dv `w'_xtra5min_dv `w'_xtra5minosm_dv `w'_ypdklm; #delimit cr keep `r(varlist)' compress // (ii) create a wave variable gen byte wave = strpos("abcdefghijklm","`w'") // (iii) drop the wave prefix from all variables that had one rename `w'_* * // save each wave specific file order pidp wave label variable wave "US wave" save "$outpath/`w'tempwaveindividual.dta", replace } ******************************************************************************** * Step 1b * Nurse health assessment * Using files indresp (indivudual respondent information) foreach w in b c { use "$inpath/ukhls/`w'_indresp_ns", clear #delimit ; isvar pidp `w'_hidp `w'_medcnjd `w'_tbmed `w'_statins `w'_statina_med `w'_folic `w'_folpreghr `w'_lipid_med `w'_iron_med `w'_medtyp1 `w'_medtyp2 `w'_medtyp3 `w'_medtyp4 `w'_medtyp5 `w'_medtyp6 `w'_medtyp7 `w'_medtyp8 `w'_medtyp9 `w'_medtyp10 `w'_medtyp11 `w'_medtyp12 `w'_medtyp13 `w'_medcnj `w'_resphts `w'_height `w'_estht `w'_weight `w'_bfpc `w'_bfpcval `w'_relwaitb `w'_estwt `w'_respbps `w'_mmgswil `w'_mmgsdval `w'_mmgsnval `w'_mmgsdom `w'_mmgssta `w'_mmgsd1 `w'_mmgsn1 `w'_mmgsd2 `w'_mmgsn2 `w'_mmgsd3 `w'_mmgsn3 `w'_mmgstp `w'_mmgsres `w'_htfvc `w'_htfev `w'_htpef `w'_htfevfvc `w'_htfvc_sc `w'_htfev_sc `w'_htpef_sc `w'_htfevfvc_sc `w'_bfck2 `w'_bsoute `w'_wtok `w'_htval `w'_wtval `w'_lfout `w'_numed2 `w'_nurdayd `w'_nurdaym `w'_nurdayy `w'_nurdayw `w'_gor_dv `w'_sex_dv `w'_age_dv `w'_elig `w'_ethnic `w'_ethn_dv `w'_sys1 `w'_dias1 `w'_pulse1 `w'_map1 `w'_sys2 `w'_dias2 `w'_pulse2 `w'_map2 `w'_sys3 `w'_dias3 `w'_pulse3 `w'_map3 `w'_omsysval `w'_omdiaval `w'_ompulval `w'_ommapval `w'_ag16g10 `w'_ag16g20 `w'_bprespc `w'_waist1 `w'_waist2 `w'_waist3 `w'_wstokb `w'_wstval `w'_bmi `w'_bmival `w'_hyper1 `w'_hyper2 `w'_indnsus_lw `w'_indnsus_xw / ; #delimit cr keep `r(varlist)' compress // (ii) create a wave variable gen byte wave = strpos("bc","`w'") + 1 tab wave // (iii) drop the wave prefix from all variables that had one rename `w'_* * order pidp wave label variable wave "US wave" save "$outpath/`w'tempwaveindividual_healthassesment.dta", replace } ******************************************************************************** * Files indall (individual all information) foreach w in a b c d e f g h i j k l m { // (i) Extract the variables needed use "$inpath/ukhls/`w'_indall", clear isvar pidp `w'_hidp `w'_agegr10_dv `w'_intdaty_dv `w'_intdatm_dv `w'_iproxy `w'_ivlolw `w'_ff_everint `w'_modetype keep `r(varlist)' compress // (ii) create a wave variable gen byte wave = strpos("abcdefghijkl","`w'") // (iii) drop the wave prefix from all variables that had one rename `w'_* * // save each wave specific file order pidp wave label variable agegr10_dv "agegr10_dv at wave interview" label variable wave "US wave" save "$outpath/`w'tempwaveindividualall.dta", replace } ******************************************************************************** * Files indsamp (individual sample information) * no a_indsamp wave existing foreach w in b c d e f g h i j k l m { // (i) Extract the variables needed use "$inpath/ukhls/`w'_indsamp", clear isvar pidp `w'_hidp `w'_finloc `w'_ivfio `w'_ivfho keep `r(varlist)' compress // (ii) create a wave variable gen byte wave = strpos("abcdefghijklm","`w'") // (iii) drop the wave prefix from all variables that had one rename `w'_* * // save each wave specific file order pidp wave save "$outpath/`w'tempwaveindividualsamp.dta", replace } * Covid survey data use "$inpath/ukhls/ch_indresp_w.dta", clear keep pidp ch_cvhlthlink distinct pidp rename ch_cvhlthlink healthdatalinkagew8 tab healthdatalinkagew8, mi label variable healthdatalinkagew8 "Health data linkage in w8 of covid survey" save "$outpath/individualcovidsurvey.dta", replace *********************************************************************************************************************************************************** *INSERT ISER hcond Box 1 to Box 4 ******************************************************************************** *Box 1 * The responses to the health conditions question, HCONDN were provided as a series of 17 variables, HCONDN1-HCONDN17, with values 0 (Not mentioned) or 1 (Mentioned). * Produces for a indresp and wave *: _hcondn* _hcondns* _hospc* hospdc*.dta foreach w in b c d e { use pidp `w'_hcondn* `w'_hospc* `w'_hospdc* using "`w'_indresp.dta", clear // (ii) create a wave variable gen byte wave = strpos("abcdefghijkl","`w'") local x=8 if "`w'"=="d" { local x=10 } if "`w'"=="e" { local x=7 } forvalues k=1/17 { generat int `w'_hcondnS`k'=. generat `w'_hospC`k'=. generat int `w'_hospDC`k'=. forvalues i=1/`x' { replace `w'_hcondnS`k'=`w'_hcondns`i' if `w'_hcondno`i'==`k' replace `w'_hospC`k' =`w'_hospc`i' if `w'_hcondno`i'==`k' replace `w'_hospDC`k' =`w'_hospdc`i' if `w'_hcondno`i'==`k' } } drop `w'_hcondno* `w'_hcondns* `w'_hospc* `w'_hospdc* rename `w'_hcondnS* `w'_hcondns* rename `w'_hospC* `w'_hospc* rename `w'_hospDC* `w'_hospdc* drop `w'_hcondns6 `w'_hcondns7 } compress order pidp wave *************** foreach w in f { use pidp `w'_hcondn* `w'_hospc* `w'_hospdc* using "`w'_indresp.dta", clear // (ii) create a wave variable gen wave = strpos("abcdefghijkl","`w'") if "`w'"=="f" { local x=8 } forvalues k=1/17 { generat int `w'_hcondnS`k'=. generat int `w'_hospC`k'=. generat int `w'_hospDC`k'=. forvalues i=1/`x' { replace `w'_hcondnS`k'=`w'_hcondns`i' if `w'_hcondno`i'==`k' replace `w'_hospC`k' =`w'_hospc`i' if `w'_hcondno`i'==`k' replace `w'_hospDC`k' =`w'_hospdc`i' if `w'_hcondno`i'==`k' } } drop `w'_hcondno* `w'_hcondns* `w'_hospc* `w'_hospdc* rename `w'_hcondnS* `w'_hcondns* rename `w'_hospC* `w'_hospc* rename `w'_hospDC* `w'_hospdc* drop `w'_hcondns6 `w'_hcondns7 } compress order pidp wave *************** foreach w in g h i { use pidp `w'_hcondn* `w'_hospc* `w'_hospdc* using "`w'_indresp.dta", clear // (ii) create a wave variable gen wave = strpos("abcdefghijkl","`w'") if "`w'"=="i" { local x=8 } if "`w'"=="h" { local x=7 } if "`w'"=="g" { local x=5 } forvalues k=1/19 { generat int `w'_hcondnS`k'=. generat int `w'_hospC`k'=. generat int `w'_hospDC`k'=. forvalues i=1/`x' { replace `w'_hcondnS`k'=`w'_hcondns`i' if `w'_hcondno`i'==`k' replace `w'_hospC`k' =`w'_hospc`i' if `w'_hcondno`i'==`k' replace `w'_hospDC`k' =`w'_hospdc`i' if `w'_hcondno`i'==`k' } } drop `w'_hcondno* `w'_hcondns* `w'_hospc* `w'_hospdc* rename `w'_hcondnS* `w'_hcondns* rename `w'_hospC* `w'_hospc* rename `w'_hospDC* `w'_hospdc* drop `w'_hcondns6 `w'_hcondns7 `w'_hcondns19 drop `w'_hcondns18 `w'_hospc18 `w'_hospdc18 } compress order pidp wave save "$outpath/indresp_wave_i_hcondn_hcondns_hospc_hospdc.dta", replace ***************************************************************************************** * ISER proposed, modified and functioning use pidp j_hcondncode* j_hcondno* j_hcondns* j_hcondna* j_hospc* j_hospdc* j_hcondever97 /// using "j_indresp.dta", clear forvalues k=1/42 { generat byte j_hcondnS`k'=. generat byte j_hcondnA`k'=. generat byte j_hospC`k'=. generat byte j_hospDC`k'=. forvalues i=1/13 { replace j_hcondnS`k'=j_hcondns`i' if j_hcondno`i'==`k' replace j_hcondnA`k'=j_hcondna`i' if j_hcondno`i'==`k' replace j_hospC`k' =j_hospc`i' if j_hcondno`i'==`k' replace j_hospDC`k' =j_hospdc`i' if j_hcondno`i'==`k' } } drop j_hcondno* j_hcondns* j_hcondna* j_hospc* j_hospdc* rename j_hcondnS* j_hcondns* rename j_hcondnA* j_hcondna* rename j_hospC* j_hospc* rename j_hospDC* j_hospdc* rename j_hcondever97 j_hcondever18 // drop variables created because continuous loop was used drop j_hcondns6 j_hcondns7 j_hcondns9 j_hospc9 j_hospdc9 j_hcondns13 j_hospc13 j_hospdc13 j_hcondns14 j_hospc14 j_hospdc14 j_hcondns17 j_hospc17 j_hospdc17 j_hcondns18 j_hospc18 j_hospdc18 j_hcondns20 j_hospc20 j_hospdc20 j_hcondns22 j_hospc22 j_hospdc22 j_hcondns25 j_hospc25 j_hospdc25 j_hcondns30 j_hospc30 j_hospdc30 j_hcondns32 j_hospc32 j_hospdc32 j_hcondns36 j_hospc36 j_hospdc36 save "indresp_wave_j_hcondncode_hcondns_hcondever_hcondna_hospc_hospdc.dta", replace drop j_hcondncode* j_hcondns* j_hospc* j_hospdc* j_hcondever18 rename j_hcondna1 hcond_asthma_age_w1tola_minw10 rename j_hcondna3 hcond_hf_age_w1tola_minw10 rename j_hcondna4 hcond_chd_age_w1tola_minw10 rename j_hcondna5 hcond_angina_age_w1tola_minw10 rename j_hcondna6 hcond_hatmi_age_w1tola_minw10 rename j_hcondna7 hcond_stroke_age_w1tola_minw10 rename j_hcondna8 hcond_emphys_age_w1tola_minw10 rename j_hcondna10 hcond_hypothy_age_w1tola_minw10 rename j_hcondna11 hcond_bron_age_w1tola_minw10 rename j_hcondna12 hcond_liver_age_w1tola_minw10 rename j_hcondna15 hcond_epilep_age_w1tola_minw10 rename j_hcondna16 hcond_hyperte_age_w1tola_minw10 rename j_hcondna17 hcond_clindepress_age_na rename j_hcondna18 hcond_chrhcondother_age_na rename j_hcondna19 hcond_ms_age_w1tola_minw10 rename j_hcondna20 hcond_hiv_age_w1tola_minw10 rename j_hcondna21 hcond_copd_age_w10tola_minw10 rename j_hcondna22 hcond_emnervpsychpr_age_na rename j_hcondna23 hcond_arthoesto_age_na rename j_hcondna24 hcond_arthrheum_age_na rename j_hcondna25 hcond_arthother_age_na rename j_hcondna26 hcond_maligcolon_age_na rename j_hcondna27 hcond_maliglung_age_na rename j_hcondna28 hcond_maligbreast_age_na rename j_hcondna29 hcond_maligprost_age_na rename j_hcondna30 hcond_maligliver_age_na rename j_hcondna31 hcond_maligskin_age_na rename j_hcondna32 hcond_maligother_age_na rename j_hcondna33 hcond_diabetestyp1_age_na rename j_hcondna34 hcond_diabetestyp2_age_na rename j_hcondna35 hcond_diabetestypge_age_na rename j_hcondna36 hcond_diabetestypot_age_na rename j_hcondna37 hcond_anxiety_age_na rename j_hcondna38 hcond_depress_age_na rename j_hcondna39 hcond_psychosis_age_na rename j_hcondna40 hcond_bipolar_age_na rename j_hcondna41 hcond_eatingdo_age_na rename j_hcondna42 hcond_pts_age_na /* Arthritis, diabetes, malignancy */ egen byte hcond_arthr_age_w1tola_minw10=rowmin(hcond_arthoesto_age_na hcond_arthrheum_age_na hcond_arthother_age_na) egen byte hcond_diab_age_w1tola_minw10= rowmin(hcond_diabetestyp1_age_na hcond_diabetestyp2_age_na hcond_diabetestypge_age_na hcond_diabetestypot_age_na) egen byte hcond_malig_age_w1tola_minw10=rowmin(hcond_maligbreast_age_na hcond_maligcolon_age_na hcond_maligliver_age_na hcond_maliglung_age_na hcond_maligother_age_na hcond_maligprost_age_na hcond_maligskin_age_na) label variable hcond_angina_age_w1tola_minw10 "Angina age told ever in w10" label variable hcond_anxiety_age_na "Anxiety age told ever in w10" label variable hcond_arthr_age_w1tola_minw10 "Arthritis age told ever in w10" label variable hcond_arthoesto_age_na "Osteoarthritis age told ever in w10" label variable hcond_arthother_age_na "Arthritis other age told ever in w10" label variable hcond_arthrheum_age_na "Rheumatoid Arthritis age told ever in w10" label variable hcond_asthma_age_w1tola_minw10 "Asthma age told ever in w10" label variable hcond_bipolar_age_na "Bipolar disorder age told ever in w10" label variable hcond_bron_age_w1tola_minw10 "Chronic bronchitis age told ever in w10" label variable hcond_chd_age_w1tola_minw10 "CHD age told ever in w10" label variable hcond_chrhcondother_age_na "Chronic conditions age told ever in w10" label variable hcond_clindepress_age_na "Clinical depression age told ever in w10" label variable hcond_hf_age_w1tola_minw10 "Heart failure age told ever in w10" label variable hcond_copd_age_w10tola_minw10 "COPD age told ever in w10" label variable hcond_diab_age_w1tola_minw10 "Diabetes age told ever in w10" label variable hcond_diabetestyp1_age_na "Diabetes type 1 age told ever in w10" label variable hcond_diabetestyp2_age_na "Diabetes type 2 age told ever in w10" label variable hcond_diabetestypge_age_na "Diabetes type gestational age told ever in w10" label variable hcond_diabetestypot_age_na "Diabetes type other age told ever in w10" label variable hcond_eatingdo_age_na "Eating disorder age told ever in w10" label variable hcond_emnervpsychpr_age_na "Emotional, nervem psychological problem age told ever in w10" label variable hcond_emphys_age_w1tola_minw10 "Emphysema age told ever in w10" label variable hcond_epilep_age_w1tola_minw10 "Epilepsy age told ever in w10" label variable hcond_hatmi_age_w1tola_minw10 "Heart attack/MI age told ever in w10" label variable hcond_hiv_age_w1tola_minw10 "HIV age told ever in w10" label variable hcond_hyperte_age_w1tola_minw10 "Hypertension age told ever in w10" label variable hcond_hypothy_age_w1tola_minw10 "Hypothyroidism age told ever in w10" label variable hcond_liver_age_w1tola_minw10 "Liver condition age told ever in w10" label variable hcond_malig_age_w1tola_minw10 "Malignancy condition age told ever in w10" label variable hcond_maligbreast_age_na "Malignancy breast age told ever in w10" label variable hcond_maligcolon_age_na "Malignancy colon age told ever in w10" label variable hcond_maligliver_age_na "Malignancy liver age told ever in w10" label variable hcond_maliglung_age_na "Malignancy lung age told ever in w10" label variable hcond_maligother_age_na "Malignancy other age told ever in w10" label variable hcond_maligprost_age_na "Malignancy prostata age told ever in w10" label variable hcond_maligskin_age_na "Malignancy skin age told ever in w10" label variable hcond_ms_age_w1tola_minw10 "Multiple sclerosis age told ever in w10" label variable hcond_psychosis_age_na "Psychosis age told ever in w10" label variable hcond_pts_age_na "PTS age told ever in w10" label variable hcond_stroke_age_w1tola_minw10 "Stroke condition age told ever in w10" *** mdesc *** sum compress save "$outpath/indresp_wave_j_hcondncode_hcondns_hcondever_hcondna_hospc_hospdc_reduced.dta", replace ******************************************************************************** *Box 3 * Wave 11 onwards * Questions for new entrants remained the same. * All continuing sample members, were asked * If they still had the health conditions they had reported in a previous wave (FF_PREVHCONDSTIL*). * whether they still had it or not in HCONDP1-10. See Box 3 to convert these into the 37 health condition variables. foreach w in k l m { use pidp `w'_prevhcondno* `w'_hcondp* `w'_hospcp* `w'_hospdcp* using "`w'_indresp.dta", clear /*Not "$ms/`w'_indresp.dta", clear*/ if "`w'"=="k" { local x=10 } if "`w'"=="l" { local x=9 } generat `w'_prevhcondstil96=1 forvalues i=1/`x' { replace `w'_prevhcondstil96=0 if `w'_prevhcondno`i'>0 } foreach k in 1 3 4 5 6 7 8 10 11 12 15 16 19 21 23 24 25 26 27 28 29 /// 30 31 32 33 34 35 36 37 38 39 40 41 42 43 97 { generat int `w'_prevhcondstil`k'=0 generat int `w'_hcondP`k'=. generat int `w'_hospCP`k'=. generat int `w'_hospDCP`k'=. forvalues i=1/`x' { replace `w'_prevhcondstil`k' =1 if `w'_prevhcondno`i'==`k' replace `w'_hcondP`k' =`w'_hcondp`i' if `w'_prevhcondno`i'==`k' replace `w'_hospCP`k' =`w'_hospcp`i' if `w'_prevhcondno`i'==`k' replace `w'_hospDCP`k'=`w'_hospdcp`i' if `w'_prevhcondno`i'==`k' } } drop `w'_prevhcondno* `w'_hcondp* `w'_hospcp* `w'_hospdcp* rename `w'_hcondP* `w'_hcondp* rename `w'_hospCP* `w'_hospcp* rename `w'_hospDCP* `w'_hospdcp* drop `w'_hcondp6 `w'_hcondp7 `w'_hcondp19 `w'_hcondp25 `w'_hospcp25 `w'_hospdcp25 `w'_hcondp32 `w'_hospcp32 `w'_hospdcp32 `w'_hcondp36 `w'_hospcp36 `w'_hospdcp36 `w'_hcondp43 `w'_hospcp43 `w'_hospdcp43 `w'_hcondp97 `w'_hospcp97 `w'_hospdcp97 } compress save "$outpath/indresp_wave_l_hcondp_hospdcp_prevhcondstil.dta", replace ******************************************************************************** *Box 4 * associated with the health conditions reported in HCONDNCODE1, 3-8, 10-12, * Their responses to the questions, whether they still had this condition, whether they had been to the hospital for this condition and the number of days during the hospital visits were recorded in foreach w in k l { use pidp `w'_hcondncode* `w'_hcondno* `w'_hcondns* `w'_hospc* `w'_hospdc* using "`w'_indresp.dta", clear /*Not "$ms/`w'_indresp.dta", clear*/ if "`w'"=="k"|"`w'"=="l" |"`w'"=="m" { local x=9 } foreach k in 1 3 4 5 6 7 8 10 11 12 15 16 19 21 23 24 25 26 27 28 29 /// 30 31 32 33 34 35 36 37 38 39 40 41 42 43 97 { generat int `w'_hcondnS`k'=. generat int `w'_hospC`k'=. generat int `w'_hospDC`k'=. forvalues i=1/`x' { replace `w'_hcondnS`k'=`w'_hcondns`i' if `w'_hcondno`i'==`k' replace `w'_hospC`k' =`w'_hospc`i' if `w'_hcondno`i'==`k' replace `w'_hospDC`k' =`w'_hospdc`i' if `w'_hcondno`i'==`k' } } drop `w'_hcondno* `w'_hcondns* `w'_hospc* `w'_hospdc* rename `w'_hcondnS* `w'_hcondns* rename `w'_hospC* `w'_hospc* rename `w'_hospDC* `w'_hospdc* drop `w'_hcondns6 `w'_hcondns7 `w'_hcondns19 `w'_hcondns25 `w'_hospc25 `w'_hospdc25 `w'_hcondns32 `w'_hospc32 `w'_hospdc32 `w'_hcondns36 `w'_hospc36 `w'_hospdc36 `w'_hcondns43 `w'_hospc43 `w'_hospdc43 `w'_hcondns97 `w'_hospc97 `w'_hospdc97 } compress save "$outpath/indresp_wave_l_hcondncode_hcondns_hospc_hospdc.dta", replace *********************************************************************************************************************************************************** * Step 2a * Open the file for wave a and then add the rest of the waves specific files * Appending all individualresp files and creating one file use "$outpath/atempwaveindividual.dta", clear foreach w in b c d e f g h i j k l m { append using "$outpath/`w'tempwaveindividual.dta" } sort pidp wave describe * Renaming variables rename adla adl_ability_managestairs rename adlad adl_eaeof_managestairs rename adlb adl_ability_getaroundhouse rename adlbd adl_easeof_getaroundhouse rename adlc adl_ability_getinoutofbed rename adlcd adl_easeof_getinoutofbed rename adld adl_ability_cuttoenails rename adldd adl_easeof_cuttoenails rename adle adl_ability_bathshower rename adled adl_easeof_bathshower rename adlf adl_ability_walkdownroad rename adlfd adl_easeof_walkdownroad rename adlg adl_ability_usetoilet rename adlgd adl_easeof_usetoilet rename adlh adl_ability_eat rename adlhd adl_easeof_eat rename adli adl_ability_washfaceandhands rename adlid adl_easeof_washfaceandhands rename adlj adl_ability_getdressed rename adljd adl_easeof_getdressed rename adlk adl_ability_takerightmedicines rename adlkd adl_easeof_takerightmedicines rename adll adl_ability_doshopping rename adlld adl_easeof_doshopping rename adlm adl_ability_laundryhousework rename adlmd adl_easeof_laundryhousework rename adln adl_ability_paperwork rename adlnd adl_easeof__paperwork rename age_dv ageatinterview_dv rename country countryofresidence * Disdif (disabilities and difficulties) variables rename disdif1 disdif_mobilityFI rename disdif2 disdif_movingobjectsFI rename disdif3 disdif_manualdexterityFI rename disdif4 disdif_continenceFI rename disdif5 disdif_hearingFI rename disdif6 disdif_sightFI rename disdif7 disdif_communicationFI rename disdif8 disdif_concentratingabbilityFI rename disdif9 disdif_recognisingdangerFI rename disdif10 disdif_physicalcoordinationFI rename disdif11 disdif_difficultiescareFI rename disdif12 disdif_otherhealthproblemsFI rename disdif96 disdif_anyhealthproblemsatall rename dissev8 dissev_memorydifficulty rename drgmj drugcannabis rename drgoth drugsother rename drgsol druggluesolventsniffing rename ff_ivlolw fed_forward_interv_outcome_iser rename ff_everint fed_forward_ever_interv_iser * hcond (health condition) disease variables (existing and still) * hconda: Age told having health condition * health condition number mentioned: not equivalent to hcond numbering rename hcondno1 healthconditionnumber_1 rename hcondno2 healthconditionnumber_2 rename hcondno3 healthconditionnumber_3 rename hcondno4 healthconditionnumber_4 rename hcondno5 healthconditionnumber_5 rename hcondno6 healthconditionnumber_6 rename hcondno7 healthconditionnumber_7 rename hcondno8 healthconditionnumber_8 rename hcondno9 healthconditionnumber_9 rename hcondno10 healthconditionnumber_10 rename hcondno11 healthconditionnumber_11 rename hcondno12 healthconditionnumber_12 rename hcondno13 healthconditionnumber_13 rename hcondns1 healthconditionnumber_newstil_1 rename hcondns2 healthconditionnumber_newstil_2 rename hcondns3 healthconditionnumber_newstil_3 rename hcondns4 healthconditionnumber_newstil_4 rename hcondns5 healthconditionnumber_newstil_5 rename hcondns6 healthconditionnumber_newstil_6 rename hcondns7 healthconditionnumber_newstil_7 rename hcondns8 healthconditionnumber_newstil_8 rename hcondns9 healthconditionnumber_newstil_9 rename hcondns10 healthconditionnumber_newstil_10 rename hcondns11 healthconditionnumber_newstil_11 rename hcondns12 healthconditionnumber_newstil_12 rename hcondns13 healthconditionnumber_newstil_13 ***************** * Asthma 1 rename hcond1 hcond_asthma_hcond rename hconda01 hcond_asthma_age_w1tola rename hcondcode1 hcond_asthma_hcondw10p rename hcondever1 hcond_asthma_everinw10 rename hcondn1 hcond_asthma_newwave2to9 rename hcondncode1 hcond_asthma_newwave10p rename hcondnew1 hcond_asthma_newwave11p rename hconds01 hcond_asthma_still *Arthritis 2 rename hcond2 hcond_arthr_hcond rename hconda02 hcond_arthr_age_w1to9 rename hconda23 hcond_arthrosteo_w10plus_age rename hconda24 hcond_arthrheum_w10plus_age rename hcondcode23 hcond_arthroesto_hcondw10p rename hcondcode24 hcond_arthrheumatoid_hcondw10p rename hcondcode25 hcond_arthrother_hcondw10p rename hcondever2 hcond_arthr_everinw10 rename hcondn2 hcond_arthr_newwave2to9 rename hcondncode23 hcond_arthoesto_newwave10p rename hcondncode24 hcond_arthrheum_newwave10p rename hcondncode25 hcond_arthother_newwave10p rename hcondnew2 hcond_arthr_newwave11p rename hconds02 hcond_arthr_still * Congestive heart failure 3 rename hcond3 hcond_hf_hcond rename hconda03 hcond_hf_age_w1tola rename hcondcode3 hcond_hf_hcondw10p rename hcondever3 hcond_hf_everinw10 rename hcondn3 hcond_hf_newwave2to9 rename hcondncode3 hcond_hf_newwave10p rename hcondnew3 hcond_hf_newwave11p rename hconds03 hcond_hf_still * CHD 4 rename hcond4 hcond_chd_hcond rename hconda04 hcond_chd_age_w1tola rename hcondcode4 hcond_chd_hcondw10p rename hcondever4 hcond_chd_everinw10 rename hcondn4 hcond_chd_newwave2to9 rename hcondncode4 hcond_chd_newwave10p rename hcondnew4 hcond_chd_newwave11p rename hconds04 hcond_chd_still * Angina 5 rename hcond5 hcond_angina_hcond rename hconda05 hcond_angina_age_w1tola rename hcondcode5 hcond_angina_hcondw10p rename hcondever5 hcond_angina_everinw10 rename hcondn5 hcond_angina_newwave2to9 rename hcondncode5 hcond_angina_newwave10p rename hcondnew5 hcond_angina_newwave11p rename hconds05 hcond_angina_still * Heart attack or myocardial infarction 6 rename hcond6 hcond_hatmi_hcond rename hconda06 hcond_hatmi_age_w1tola rename hcondcode6 hcond_hatmi_hcondw10p rename hconde6 hcond_hatmi_everinw3 rename hcondea6 hcond_heartattack_inw3_agetold rename hcondever6 hcond_hatmi_everinw10 rename hcondn6 hcond_hatmi_newwave2to9 rename hcondncode6 hcond_hatmi_newwave10p rename hcondnew6 hcond_hatmi_newwave11p rename hconds06 hcond_hatmi_still * Stroke 7 rename hcond7 hcond_stroke_hcond rename hconda07 hcond_stroke_age_w1tola rename hcondcode7 hcond_stroke_hcondw10p rename hconde7 hcond_stroke_everinw3 rename hcondea7 hcond_stroke_inw3_agetold rename hcondever7 hcond_stroke_everinw10 rename hcondn7 hcond_stroke_newwave2to9 rename hcondncode7 hcond_stroke_newwave10p rename hcondnew7 hcond_stroke_newwave11p rename hconds07 hcond_stroke_still * Emphysema 8 rename hcond8 hcond_emphys_hcond rename hconda08 hcond_emphys_age_w1tola rename hcondcode8 hcond_emphys_hcondw10p rename hcondever8 hcond_emphys_everinw10 rename hcondn8 hcond_emphys_newwave2to9 rename hcondncode8 hcond_emphys_newwave10p rename hcondnew8 hcond_emphys_newwave11p rename hconds08 hcond_emphys_still * Hyperthyroidism 9 only w1-w9 rename hcond9 hcond_hyperthy_hcond rename hconda09 hcond_hyperthy_age_w1tola rename hcondn9 hcond_hyperthy_newwave2to9 rename hconds09 hcond_hyperthy_still * Hypothyroidism 10 rename hcond10 hcond_hypothy_hcond rename hconda10 hcond_hypothy_age_w1tola rename hcondcode10 hcond_hypothy_hcondw10p rename hcondever10 hcond_hypothy_everinw10 rename hcondn10 hcond_hypothy_newwave2to9 rename hcondncode10 hcond_hypothy_newwave10p rename hcondnew10 hcond_hypothy_newwave11p rename hconds10 hcond_hypothy_still * Chronic bronchitis 11 rename hcond11 hcond_bron_hcond rename hconda11 hcond_bron_age_w1tola rename hcondcode11 hcond_bron_hcondw10p rename hcondever11 hcond_bron_everinw10 rename hcondn11 hcond_bron_newwave2to9 rename hcondncode11 hcond_bron_newwave10p rename hcondnew11 hcond_bron_newwave11p rename hconds11 hcond_bron_still * Liver condition 12 rename hcond12 hcond_liver_hcond rename hconda12 hcond_liver_age_w1tola rename hcondcode12 hcond_liver_hcondw10p rename hcondever12 hcond_liver_everinw10 rename hconds12 hcond_liver_still rename hcondn12 hcond_liver_newwave2to9 rename hcondncode12 hcond_liver_newwave10p rename hcondnew12 hcond_liver_newwave11p * Malignancy 13 rename hcond13 hcond_malig_hcond rename hconda13 hcond_malig_age_w1to9 rename hconda27 hcond_maliglung_w10plus_age rename hconda28 hcond_maligbreast_w10plus_age rename hconda29 hcond_maligprost_w10plus_age rename hconda30 hcond_maligliver_w10plus_age rename hconda31 hcond_maligskin_w10plus_age rename hcondever13 hcond_malig_everinw10 rename hcondn13 hcond_malig_newwave2to9 rename hcondcode26 hcond_maligcolon_hcondw10p rename hcondcode27 hcond_maliglung_hcondw10p rename hcondcode28 hcond_maligbreast_hcondw10p rename hcondcode29 hcond_maligprostata_hcondw10p rename hcondcode30 hcond_maligliver_hcondw10p rename hcondcode31 hcond_maligskin_hcondw10p rename hcondcode32 hcond_maligother_hcondw10p rename hcondncode26 hcond_maligcolon_newwave10p rename hcondncode27 hcond_maliglung_newwave10p rename hcondncode28 hcond_maligbreast_newwave10p rename hcondncode29 hcond_maligprostata_newwave10p rename hcondncode30 hcond_maligliver_newwave10p rename hcondncode31 hcond_maligskin_newwave10p rename hcondncode32 hcond_maligother_newwave10p rename hcondnew13 hcond_malig_newwave11p rename hconds13 hcond_malig_still * Diabetes 14 rename hcond14 hcond_diab_hcond rename hconda14 hcond_diab_age_w1to9 rename hconda33 hcond_diabettyp1_w10plus_age rename hconda34 hcond_diabettyp2_w10plus_age rename hconda35 hcond_diabettypge_w10plus_age rename hcondever14 hcond_diab_everinw10 rename hcondn14 hcond_diab_newwave2to9 rename hcondcode33 hcond_diabetestyp1_hcondw10p rename hcondcode34 hcond_diabetestyp2_hcondw10p rename hcondcode35 hcond_diabetestypge_hcondw10p rename hcondcode36 hcond_diabetestypot_hcondw10p rename hcondncode33 hcond_diabetestyp1_newwave10p rename hcondncode34 hcond_diabetestyp2_newwave10p rename hcondncode35 hcond_diabetestypge_newwave10p rename hcondncode36 hcond_diabetestypot_newwave10p rename hcondnew14 hcond_diab_newwave11p rename hconds14 hcond_diab_still * Epilepsy 15 rename hcond15 hcond_epilep_hcond rename hconda15 hcond_epilep_age_w1tola rename hcondcode15 hcond_epilep_hcondw10p rename hcondever15 hcond_epilep_everinw10 rename hcondn15 hcond_epilep_newwave2to9 rename hcondncode15 hcond_epilep_newwave10p rename hcondnew15 hcond_epilep_newwave11p rename hconds15 hcond_epilep_still * Hypertension 16 rename hcond16 hcond_hyperte_hcond rename hconda16 hcond_hyperte_age_w1tola rename hcondcode16 hcond_hyperte_hcondw10p rename hcondever16 hcond_hyperte_everinw10 rename hcondn16 hcond_hyperte_newwave2to9 rename hcondncode16 hcond_hyperte_newwave10p rename hcondnew16 hcond_hyperte_newwave11p rename hconds16 hcond_hyperte_still * Clinical Depression 17 only waves 1-9 rename hcond17 hcond_cdepress_hcond rename hconda17 hcond_depress_age_w10to12 rename hcondn17 hcond_cdepress_newwave2to9 * Multiple sclerosis 19 rename hcond19 hcond_ms_hcond rename hconda19 hcond_ms_age_w1tola rename hcondcode19 hcond_ms_hcondw10p rename hcondever19 hcond_ms_everinw10 rename hcondn19 hcond_ms_newwave2to9 rename hcondncode19 hcond_ms_newwave10p rename hcondnew19 hcond_ms_newwave11p * HIV only from waves 7-12 gen byte hcond20=. if wave<=6 gen byte hconda20=. if wave<=6 gen byte hcondcode20=. if wave<=9 gen byte hcondncode20=. if wave<=9 gen byte hcondnew20=. if wave<=9 rename hcond20 hcond_hiv_hcond rename hconda20 hcond_hiv_age_w7tola rename hcondcode20 hcond_hiv_hcondw10p rename hcondever20 hcond_hiv_everinw10 rename hcondn20 hcond_hiv_newwave2to9 rename hcondncode20 hcond_hiv_newwave10p rename hcondnew20 hcond_hiv_newwave11p * COPD 21 only from waves 10-12 rename hcond21 hcond_copd_hcond rename hconda21 hcond_copd_age_w10tola rename hcondcode21 hcond_copd_hcondw10p rename hcondever21 hcond_copd_everinw10 rename hcondncode21 hcond_copd_newwave10p rename hcondnew21 hcond_copd_newwave11p rename hconds21 hcond_copd_still rename hconda37 hcond_anxiety_age_w10tola rename hconda38 hcond_depress_age_w10tola rename hconda39 hcond_psychosis_age_w10tola rename hconda40 hcond_bidepress_age_w10tola rename hconda41 hcond_eatingdis_age_w10tola rename hconda42 hcond_posttrau_age_w10tola * Longstanding illness rename health hcond_longstandill_hcond * Other emnervpsychproblem not existing 22 rename hcond22 hcond_emnervpsychproblem_hcond rename hcondever22 hcond_emnervpsyprob_everinw10 rename hcondnew22 hcond_emnervpsych_newwave11p * Other emotional, nervous or psychiatric problem 43 rename hcondcode43 hcond_psychprobother_hcond rename hcondncode43 hcond_psychprobother_hcondw10p * None of the listed health conditions 96 rename hcond96 hcond_noneoflisted_hcond rename hcondcode96 hcond_noneoflisted_hcondw10p rename hconde96 hcond_noneoflisted_everinw3 rename hcondever96 hcond_noneoflisted_everinw10 rename hcondn96 hcond_noneoflisted_newwave2to9 rename hcondncode96 hcond_nonelisted_newwave10p rename hcondnew96 hcond_noneoflisted_newwave11p * Other long standing/chronic condition 97 * rename hcond97 not existing rename hcondcode97 hcond_chrhcondother_hcondw10p rename hcondever97 hcond_chrhcondother_everinw10 rename hcondncode97 hcond_chrhcondother_newwave10p rename hcondnew97 hcond_chrhcondother_newwave11p rename hconds97 hcond_chrhcondother_still gen int ageatinterview_dv_sq=ageatinterview_dv^2 * Labeling label variable ageatinterview_dv_sq "Age at interview square" * Hcond label variable hcond_angina_hcond "Angina hcond new entrants in w1 or wlater" label variable hcond_asthma_hcond "Asthma hcond new entrants in w1 or wlater" label variable hcond_arthr_hcond "Arthritis hcond new entrants in w1 or wlater" label variable hcond_chd_hcond "CHD hcond new entrants in w1 or wlater" label variable hcond_hf_hcond "Heart failure hcond new entrants in w1 or wlater" label variable hcond_bron_hcond "Chronic bronchitis hcond new entrants in w1 or wlater" label variable hcond_copd_hcond "COPD hcond new entrants in w10 or wlater" label variable hcond_diab_hcond "Diabetes hcond new entrants in w1 or wlater" label variable hcond_emphys_hcond "Emphysema hcond new entrants in w1 or wlater" label variable hcond_epilep_hcond "Epilepsy hcond new entrants in w1 or wlater" label variable hcond_hatmi_hcond "Heart attack/MI hcond new entrants in w1 or wlater" label variable hcond_hiv_hcond "Heart attack/MI hcond new entrants in w7 or wlater" label variable hcond_hyperte_hcond "Hypertension hcond new entrants in w1 or wlater" label variable hcond_hypothy_hcond "Hypothyroidism hcond new entrants in w1 or wlater" label variable hcond_liver_hcond "Liver hcond new entrants in w1 or wlater" label variable hcond_malig_hcond "Malignancy hcond new entrants in w1 or wlater" label variable hcond_stroke_hcond "Stroke hcond new entrants in w1 or wlater" label variable hcond_noneoflisted_hcond "None of hconds listed new entrants in w1 or wlater" * Hcond new entrant from wave 10 label variable hcond_arthroesto_hcondw10p "HC new entrant from w10: Arthritis oesteo" label variable hcond_arthrheumatoid_hcondw10p "HC new entrant from w10: Arthritis rheumatoid" label variable hcond_arthrother_hcondw10p "HC new entrant from w10: Arthritis other" label variable hcond_angina_hcondw10p "HC new entrant from w10: Angina" label variable hcond_asthma_hcondw10p "HC new entrant from w10: Asthma" label variable hcond_chd_hcondw10p "HC new entrant from w10: CHD" label variable hcond_chrhcondother_hcondw10p "HC new entrant from w10: Chronic other health conditions" label variable hcond_bron_hcondw10p "HC new entrant from w10: Chronic bronchitis" label variable hcond_hf_hcondw10p "HC new entrant from w10: Heart failure" label variable hcond_copd_hcondw10p "HC new entrant from w10: COPD" label variable hcond_diabetestyp1_hcondw10p "HC new entrant from w10: Diabetes type 1" label variable hcond_diabetestyp2_hcondw10p "HC new entrant from w10: Diabetes type 2" label variable hcond_diabetestypge_hcondw10p "HC new entrant from w10: Diabetes type gestational" label variable hcond_diabetestypot_hcondw10 "HC new entrant from w10: Diabetes type other" label variable hcond_emphys_hcondw10p "HC new entrant from w10: Emphysema" label variable hcond_epilep_hcondw10p "HC new entrant from w10: Epilepsy" label variable hcond_hatmi_hcondw10p "HC new entrant from w10: Heart attack/MI" label variable hcond_hiv_hcondw10p "HC new entrant from w10: HIV" label variable hcond_hyperte_hcondw10p "HC new entrant from w10: Hypertension" label variable hcond_hypothy_hcondw10p "HC new entrant from w10: Hypothyroidism" label variable hcond_liver_hcondw10p "HC new entrant from w10: Liver condition" label variable hcond_maligcolon_hcondw10p "HC new entrant from w10: Malignancy: colon" label variable hcond_maliglung_hcondw10p "HC new entrant from w10: Malignancy: lung" label variable hcond_maligbreast_hcondw10p "HC new entrant from w10: Malignancy: breast" label variable hcond_maligprostata_hcondw10p "HC new entrant from w10: Malignancy: prostata" label variable hcond_maligliver_hcondw10p "HC new entrant from w10: Malignancy: liver" label variable hcond_maligskin_hcondw10p "HC new entrant from w10: Malignancy: skin" label variable hcond_maligother_hcondw10p "HC new entrant from w10: Malignancy: other" label variable hcond_noneoflisted_hcondw10p "HC new entrant from w10: None of listed health conditions" label variable hcond_psychprobother_hcondw10p "HC new entrant from w10: Other emotional, nervous or psychiatric problem" label variable hcond_stroke_hcondw10p "HC new entrant from w10: Stroke" * Hcond new in waves 2-9 label variable hcond_angina_newwave2to9 "Angina new in waves 2-9" label variable hcond_arthr_newwave2to9 "Arthritis new in wave 2-9" label variable hcond_asthma_newwave2to9 "Asthma new in wave 2-9" label variable hcond_hf_newwave2to9 "Heart failure new in waves 2-9" label variable hcond_chd_newwave2to9 "CHD new in waves 2-9" label variable hcond_bron_newwave2to9 "Chronic bronchitis new in waves 2-9" label variable hcond_diab_newwave2to9 "Diabetes new in waves 2-9" label variable hcond_hyperte_newwave2to9 "Hypertension new in waves 2-9" label variable hcond_hatmi_newwave2to9 "Heart attack/MI new in waves 2-9" label variable hcond_emphys_newwave2to9 "Emphysema new in waves 2-9" label variable hcond_epilep_newwave2to9 "Epilepsy new in waves 2-9" label variable hcond_hypothy_newwave2to9 "Hypothyroidism new in waves 2-9" label variable hcond_liver_newwave2to9 "Liver condition new in waves 2-9" label variable hcond_malig_newwave2to9 "Malignancy new in waves 2-9" label variable hcond_stroke_newwave2to9 "Stroke new in waves 2-9" label variable hcond_noneoflisted_newwave2to9 "None of listed health conditions new in waves 2-9" * Hcond ever in wave 10 and new in waves 11plus label variable hcond_angina_newwave10p "Angina ever in w10 and new in 11plus" label variable hcond_arthoesto_newwave10p "Oesteoarthritis ever in w10 and new in 11plus" label variable hcond_arthrheum_newwave10p "Rheumatoid arthritis ever in w10 and new in 11plus" label variable hcond_arthother_newwave10p "Other arthritis ever in w10 and new in 11plus" label variable hcond_asthma_newwave10p "Asthma ever in w10 and new in 11plus" label variable hcond_chd_newwave10p "CHD ever in w10 and new in 11plus" label variable hcond_chrhcondother_newwave10p "Chronic conditions other ever in w10 and new in 11plus" label variable hcond_hf_newwave10p "Heart failure ever in w10 and new in 11plus" label variable hcond_bron_newwave10p "Chronic bronchitis ever in w10 and new in 11plus" label variable hcond_diabetestyp1_newwave10p "Diabetes type 1 ever in w10 and new in 11plus" label variable hcond_diabetestyp2_newwave10p "Diabetes type 2 ever in w10 and new in 11plus" label variable hcond_diabetestypge_newwave10p "Diabetes type gestational ever in w10 and new in 11plus" label variable hcond_diabetestypot_newwave10p "Diabetes type other ever in w10 and new in 11plus" label variable hcond_emphys_newwave10p "Emphysema ever in w10 and new in 11plus" label variable hcond_epilep_newwave10p "Epilepsy ever in w10 and new in 11plus" label variable hcond_hatmi_newwave10p "Heart attack/MI ever in w10 and new in 11plus" label variable hcond_hiv_newwave10p "HIV ever in w7 and new in 11plus" label variable hcond_hyperte_newwave10p "Hypertension ever in w10 and new in 11plus" label variable hcond_hypothy_newwave10p "Hypothyroidism ever in w10 and new in 11plus" label variable hcond_copd_newwave10p "COPD ever in w10 and new in 11plus" label variable hcond_liver_newwave10p "Liver condition ever in w10 and new in 11plus" label variable hcond_maligcolon_newwave10p "Malignancy colon ever in w10 and new in 11plus" label variable hcond_maliglung_newwave10p "Malignancy lung ever in w10 and new in 11plus" label variable hcond_maligbreast_newwave10p "Malignancy breast ever in w10 and new in 11plus" label variable hcond_maligprostata_newwave10p "Malignancy prostata ever in w10 and new in 11plus" label variable hcond_maligliver_newwave10p "Malignancy liver ever in w10 and new in 11plus" label variable hcond_maligskin_newwave10p "Malignancy skin ever in w10 and new in 11plus" label variable hcond_maligother_newwave10p "Malignancy other ever in w10 and new in 11plus" label variable hcond_nonelisted_newwave10p "None of listed health conditions ever in w10 and new in 11plus" label variable hcond_stroke_newwave10p "Stroke ever in w10 and new in 11plus" * Hcond ever in waves 10 label variable hcond_angina_everinw10 "Angina ever in wave 10" label variable hcond_arthr_everinw10 "Arthritis ever in wave 10" label variable hcond_asthma_everinw10 "Asthma ever in wave 10" label variable hcond_bron_everinw10 "Chronic bronchitis ever in wave 10" label variable hcond_chd_everinw10 "CHD ever in wave 10" label variable hcond_chrhcondother_everinw10 "Chronic conditions other ever in wave 10" label variable hcond_copd_everinw10 "COPD ever in wave 10" label variable hcond_emnervpsyprob_everinw10 "Emotional, nervous or psychiatric problemever in wave 10" label variable hcond_emphys_everinw10 "Emphysema ever in wave 10" label variable hcond_epilep_everinw10 "Epilepsy ever in wave 10" label variable hcond_diab_everinw10 "Diabetes ever in wave 10" label variable hcond_hatmi_everinw10 "Heart attack/MI ever in wave 10" label variable hcond_hf_everinw10 "Heart failure ever in wave 10" label variable hcond_hyperte_everinw10 "Hypertension ever in wave 10" label variable hcond_hypothy_everinw10 "Hypothyroidism ever in wave 10" label variable hcond_liver_everinw10 "Liver condition ever in wave 10" label variable hcond_malig_everinw10 "Malignancy ever in wave 10" label variable hcond_noneoflisted_everinw10 "None of listed health conditions ever in wave 10" label variable hcond_stroke_everinw10 "Stroke ever in wave 10" * Hcond new in waves 11 and following label variable hcond_angina_newwave11p "Angina new in waves 11plus" label variable hcond_arthr_newwave11p "Arthritis new in waves 11plus" label variable hcond_asthma_newwave11p "Asthma new in waves 11f" label variable hcond_bron_newwave11p "Chronic bronchitis new in waves 11plus" label variable hcond_chd_newwave11p "CHD new in waves 11plus" label variable hcond_diab_newwave11p "Diabetes new in waves 11plus" label variable hcond_emphys_newwave11p "Emphysema new in waves 11plus" label variable hcond_epilep_newwave11p "Epilepsy new in waves 11plus" label variable hcond_hatmi_newwave11p "Heart attack/MI new in waves 11plus" label variable hcond_hf_newwave11p "Heart failure new in waves 11plus" label variable hcond_hiv_newwave11p "HIV new in waves 11plus" label variable hcond_hyperte_newwave11p "Hypertension new in waves 11plus" label variable hcond_liver_newwave11p "Liver condition new in waves 11plus" label variable hcond_malig_newwave11p "Malignancy new in waves 11plus" label variable hcond_noneoflisted_newwave11p "None of listed health conditions new in waves 11plus" label variable hcond_stroke_newwave11p "Stroke new in waves 11plus" label variable hcond_asthma_hcondw10p "Asthma new diagnosed continuing members in w11 and further" label variable hcond_angina_age_w1tola "Starting age angina in w1-w12" label variable hcond_asthma_age_w1tola "Starting age asthma starting in w1-w12" label variable hcond_arthr_age_w1to9 "Starting age arthritis in w1-w9" label variable hcond_bron_age_w1tola "Starting age chronbronchitis in w1-w12" label variable hcond_chd_age_w1tola "Starting age chd in w1-w12" label variable hcond_copd_age_w10tola "Starting age copd in w10-w12" label variable hcond_depress_age_w10to12 "Starting age depression in w10-w12" label variable hcond_diab_age_w1to9 "Starting age diabetes in w1-w9" label variable hcond_emphys_age_w1tola "Starting age emphysema in w1-w12" label variable hcond_epilep_age_w1tola "Starting age epilepsy in w1-w12" label variable hcond_hatmi_age_w1tola "Starting age heart attack in w1-w12" label variable hcond_hf_age_w1tola "Starting age heart failure in w1-w12" label variable hcond_hiv_age_w7tola "Starting age heart attack in w7-w12" label variable hcond_hyperte_age_w1tola "Starting age hypertension in w1-w12" label variable hcond_hypothy_age_w1tola "Starting age hypothyroid in w1-w12" label variable hcond_liver_age_w1tola "Starting age liver condition in w1-w12" label variable hcond_malig_age_w1to9 "Starting age malignancy in w1-w9" label variable hcond_stroke_age_w1tola "Starting age stroke in w1-w12" label variable hcond_heartattack_inw3_agetold "Age told ever had a heart attack or MI in w3" label variable hcond_stroke_inw3_agetold "Age told ever had a stroke in w3" label variable fed_forward_interv_outcome_iser "fed_forward_interv_outcome_iser (ff_ivlolw)" label variable fed_forward_ever_interv_iser "fed forward ever interviewed (ff_everint)" rename hhorig sample_origin_household * Hospital related variables rename hl2gp visit_gplast12months rename hl2hop visit_hospitallast12months rename hospd visit_hospitalindays rename hospc1 hospitalinpatient_yn rename hospdc1 hospitalinpatient_days * Interview modus: interview_modus (onlywave 2) interview_asproxy self_completion_accepted self_completion_completed_dv self_completion_flag_dv (all waves) rename indmode interview_modus rename iproxy interview_asproxy rename ivaffct15 interview_help_sought_other rename scac self_completion_accepted rename scdata_dv self_completion_completed_dv rename scflag_dv self_completion_flag_dv * Longitudinal + self-selection weights including the ethnic minorities rename indinus_lw gpsemb_lsinterviewweight rename indinus_xw gpsemb_csinterviewweight label variable gpsemb_lsinterviewweight "GPS+EMB longitudinal interview weight w2- (indinus_lw)" label variable gpsemb_csinterviewweight "GPS+EMB cross-sectional full adult main interview weight (=indinus_xw)" rename indscub_lw self_completion_intervweightscub rename indscui_lw self_completion_intervweightscui rename indscus_lw self_completion_intervweightscus label variable self_completion_intervweightscub "Long. sc weight GPS,EMB,BHPS comb w2- (indscub_lw)" label variable self_completion_intervweightscui "Long. sc weight GPS,EMB,IEMB,BHPS comb w7- (indscui_lw)" label variable self_completion_intervweightscus "Long. sc weight GPS,EMB comb w2- (indscus_lw)" * Interview date + weights for the ethnic minorities rename istrtdaty interviewstartdate_year rename ivfio individinterview_proxy rename jbnssec_dv jobcurrent_nssec_classification rename jbstat economicactivivity_current rename jbnssec3_dv jobcurrent_nssec_classification3 rename memorig sample_origin_individual rename mhealthtyp2 hcond_mhdepression_hcond rename ncigs numbercigarettes rename qfhigh_dv education_highest rename qfhighfl_dv education_highest_flag_asked *scGHQ (general health questionnaires) + schrs_slph + sc_sleeo + sclone + variables rename scghq1_dv subjwellbeing_GHQLikertstatus rename scghq2_dv subjwellbeing_GHQCasenessstatus rename scghqa ghq_concentration rename scghqb ghq_lossofsleep rename scghqc ghq_usefulrole rename scghqd ghq_capablemakingdecisions rename scghqe ghq_constantlyunderstrain rename scghqf ghq_problemovercomdifficulties rename scghqg ghq_enjoydaytodayactivities rename scghqh ghq_abilitytofaceproblems rename scghqi ghq_unhappyordepressed rename scghqj ghq_losingconfidence rename scghqk ghq_believeinselfworth rename scghql ghq_generalhappiness rename sclfsato scl_lifesatisfactionverall rename sclfsat1 scl_healthsatisfaction rename sclonely alonelinessfeeling * Sleep variables rename schrs_slph sc_sleepinhours rename schrs_slpm sc_sleepinminutes rename scmed_slp sc_sleeppill rename sctslp_30m sc_sleepwithin30minute_yn rename sctslp_wak sc_sleepwakeupnight_yn rename sctslp_cgh sc_sleepcoughsnore rename sctsta_awk sc_awakestayingtrouble rename scslp_qual sc_sleepquality * scl_hl Health limitations rename scsf1 scs_generalhealth_scsf1_sc rename scsf2a scs_hl_moderateactivities rename scsf2b scs_hl_climbingstairs rename scsf3a scs_hl_work rename scsf3b scs_hl_kindofwork rename scsf4a scs_hl_emotionalprob_laccomplish rename scsf4b scs_hl_emotionalprob_lesscareful rename scsf5 scs_hl_painwork rename scsf6a scs_hl_feeling_calm rename scsf6b scs_hl_having_enery rename scsf6c scs_hl_feeling_depressed rename scsf7 scs_hl_emotionalprobsocialact rename scun1 scun_eyesightproblems rename scun2 scun_readingproblems rename scun3 scun_languageproblems rename scun97 scun_otherproblems * SF12 clonevar scs_generalhealth_sf1_f2f = sf1 rename sf12mcs_dv scorementalhealthcomp rename sf12pcs_dv scorephysicalhealthcomp rename tslp_wak tslp_wakeupinthenight rename tsta_awk tsta_troublestayingawakedurday rename urban_dv urbanruralresidence ********************************************* * Removing value labels * ISER interviews label values fed_forward_interv_outcome_iser label values fed_forward_ever_interv_iser *label values sample_origin_individual * hcond label values hcond_angina_hcond label values hcond_asthma_hcond label values hcond_arthr_hcond label values hcond_chd_hcond label values hcond_bron_hcond label values hcond_hf_hcond label values hcond_copd_hcond label values hcond_diab_hcond label values hcond_emnervpsychproblem_hcond label values hcond_emphys_hcond label values hcond_epilep_hcond label values hcond_hatmi_hcond label values hcond_hyperte_hcond label values hcond_hypothy_hcond label values hcond_liver_hcond label values hcond_longstandill_hcond label values hcond_malig_hcond label values hcond_mhdepression_hcond label values hcond_noneoflisted_hcond label values hcond_psychprobother_hcond label values hcond_stroke_hcond * agetold_w1tola label values hcond_angina_age_w1tola label values hcond_asthma_age_w1tola label values hcond_chd_age_w1tola label values hcond_bron_age_w1tola label values hcond_hf_age_w1tola label values hcond_emphys_age_w1tola label values hcond_epilep_age_w1tola label values hcond_hatmi_age_w1tola label values hcond_hyperte_age_w1tola label values hcond_hypothy_age_w1tola label values hcond_liver_age_w1tola label values hcond_stroke_age_w1tola * newwave2to9 label values hcond_angina_newwave2to9 label values hcond_arthr_newwave2to9 label values hcond_asthma_newwave2to9 label values hcond_hf_newwave2to9 label values hcond_chd_newwave2to9 label values hcond_bron_newwave2to9 label values hcond_diab_newwave2to9 label values hcond_emphys_newwave2to9 label values hcond_epilep_newwave2to9 label values hcond_hatmi_newwave2to9 label values hcond_hyperte_newwave2to9 label values hcond_hypothy_newwave2to9 label values hcond_liver_newwave2to9 label values hcond_malig_newwave2to9 label values hcond_noneoflisted_newwave2to9 label values hcond_stroke_newwave2to9 * everinw3 label values hcond_hatmi_everinw3 label values hcond_noneoflisted_everinw3 label values hcond_stroke_everinw3 * everinw10 label values hcond_angina_everinw10 label values hcond_arthr_everinw10 label values hcond_asthma_everinw10 label values hcond_chd_everinw10 label values hcond_chrhcondother_everinw10 label values hcond_bron_everinw10 label values hcond_hf_everinw10 label values hcond_copd_everinw10 label values hcond_diab_everinw10 label values hcond_emnervpsyprob_everinw10 label values hcond_emphys_everinw10 label values hcond_epilep_everinw10 label values hcond_hatmi_everinw10 label values hcond_hyperte_everinw10 label values hcond_hypothy_everinw10 label values hcond_liver_everinw10 label values hcond_malig_everinw10 label values hcond_noneoflisted_everinw10 label values hcond_stroke_everinw10 * newwave10p label values hcond_angina_newwave10p label values hcond_asthma_newwave10p label values hcond_chd_newwave10p label values hcond_bron_newwave10p label values hcond_hf_newwave10p label values hcond_emphys_newwave10p label values hcond_epilep_newwave10p label values hcond_hatmi_newwave10p label values hcond_hyperte_newwave10p label values hcond_hypothy_newwave10p label values hcond_liver_newwave10p label values hcond_stroke_newwave10p * newwave10p + subcategorisation arthritis, diabetes, malignancy label values hcond_arthoesto_newwave10p label values hcond_arthother_newwave10p label values hcond_arthrheum_newwave10p label values hcond_chrhcondother_newwave10p label values hcond_copd_newwave10p label values hcond_diabetestyp1_newwave10p label values hcond_diabetestyp2_newwave10p label values hcond_diabetestypge_newwave10p label values hcond_diabetestypot_newwave10p label values hcond_maligbreast_newwave10p label values hcond_maligcolon_newwave10p label values hcond_maligliver_newwave10p label values hcond_maliglung_newwave10p label values hcond_maligother_newwave10p label values hcond_maligprostata_newwave10p label values hcond_maligskin_newwave10p label values hcond_nonelisted_newwave10p label values hcond_psychprobother_hcondw10p * hcondw10p label values hcond_angina_hcondw10p label values hcond_asthma_hcondw10p label values hcond_chd_hcondw10p label values hcond_chrhcondother_hcondw10p label values hcond_bron_hcondw10p label values hcond_hf_hcondw10p label values hcond_copd_hcondw10p label values hcond_emphys_hcondw10p label values hcond_epilep_hcondw10p label values hcond_hatmi_hcondw10p label values hcond_hyperte_hcondw10p label values hcond_hypothy_hcondw10p label values hcond_liver_hcondw10p label values hcond_noneoflisted_hcondw10p label values hcond_stroke_hcondw10p * newwave11p label values hcond_angina_newwave11p label values hcond_arthr_newwave11p label values hcond_asthma_newwave11p label values hcond_chd_newwave11p label values hcond_chrhcondother_newwave11p label values hcond_bron_newwave11p label values hcond_copd_newwave11p label values hcond_hf_newwave11p label values hcond_diab_newwave11p label values hcond_emnervpsych_newwave11p label values hcond_emphys_newwave11p label values hcond_epilep_newwave11p label values hcond_hatmi_newwave11p label values hcond_hyperte_newwave11p label values hcond_hypothy_newwave11p label values hcond_liver_newwave11p label values hcond_malig_newwave11p label values hcond_noneoflisted_newwave11p label values hcond_stroke_newwave11p * disdif label values disdif_anyhealthproblemsatall label values disdif_communicationFI label values disdif_concentratingabbilityFI label values disdif_continenceFI label values disdif_difficultiescareFI label values disdif_hearingFI label values disdif_manualdexterityFI label values disdif_mobilityFI label values disdif_movingobjectsFI label values disdif_otherhealthproblemsFI label values disdif_recognisingdangerFI label values disdif_physicalcoordinationFI label values disdif_sightFI * disease still label values hcond_angina_still label values hcond_asthma_still label values hcond_arthr_still label values hcond_chd_still label values hcond_chrhcondother_still label values hcond_bron_still label values hcond_hf_still label values hcond_copd_still label values hcond_diab_still label values hcond_emphys_still label values hcond_epilep_still label values hcond_hyperte_still label values hcond_hypothy_still label values hcond_liver_still label values hcond_malig_still * scs_hl label values scs_hl_climbingstairs label values scs_hl_emotionalprob_laccomplish label values scs_hl_emotionalprob_lesscareful label values scs_hl_emotionalprobsocialact label values scs_hl_feeling_calm label values scs_hl_feeling_depressed label values scs_hl_having_enery label values scs_hl_kindofwork label values scs_hl_moderateactivities label values scs_hl_painwork label values scs_hl_work label values scs_generalhealth_scsf1_sc ********************************************* * Replace values of variables which are only available in one wave: sf1-sf7 are named differently from wave2: scsf1-scsf7 replace scs_generalhealth_sf1_f2f=sf1 if wave==1 replace scs_generalhealth_scsf1_sc=sf1 if wave==1 replace scs_hl_moderateactivities=sf2a if wave==1 replace scs_hl_climbingstairs=sf2b if wave==1 replace scs_hl_work=sf3a if wave==1 replace scs_hl_kindofwork=sf3b if wave==1 replace scs_hl_emotionalprob_laccomplish=sf4a if wave==1 replace scs_hl_emotionalprob_lesscareful=sf4b if wave==1 replace scs_hl_painwork=sf5 if wave==1 replace scs_hl_feeling_calm=sf6a if wave==1 replace scs_hl_having_enery=sf6b if wave==1 replace scs_hl_feeling_depressed=sf6c if wave==1 replace scs_hl_emotionalprobsocialact=sf7 if wave==1 *Health limitations face-to-face (F2F) only wave 1 rename (sf2a sf2b sf3a sf3b sf4a sf4b sf5 sf6a sf6b sf6c sf7) (sf2a_hl_moderateactivities sf2b_hl_climbingstairs sf3a_hl_work sf3b_hl_kindofwork sf4a_hl_emotionalprob_laccomplis sf4b_hl_emotionalprob_lesscarefu sf5_hl_painwork sf6a_hl_feeling_calm sf6b_hl_having_enery sf6c_hl_feeling_depressed sf7_hl_emotionalprobsocialact) * Recoding tab sex_dv, mi tab sex_dv, mi nolabel recode sex_dv (2=1 "Female") (1=0 "Male"), gen(sex_dv_catnew) /* Orig coding female 2 and Male 1 recoding-->female 1 and male 0 ref*/ recode hospitalinpatient_yn (2=0) recode individinterview_proxy (2=1) (1=0), gen(individinterview_proxy_catnew) tab sex_dv_catnew, mi tab sex_dv_catnew, mi nolabel tab education_highest, mi * Replacing replace hospitalinpatient_yn=0 if hospitalinpatient_yn==. replace hospitalinpatient_days=0 if hospitalinpatient_days==. * Restricting samples sum ageatinterview_dv egen byte ageatinterview_dv_categories50 = cut(ageatinterview_dv), at(50,65,80,105) label egen byte ageatinterview_dv_categories16 = cut(ageatinterview_dv), at(16,20,35,50,65,80,105) label tab ageatinterview_dv_categories50, nolabel tab ageatinterview_dv_categories16, nolabel *label variable ageatinterview_dv_categories "Age categories: 3 groups" label define ageatinterview_dv_categories50 0 "50-64" 1 "65-79" 2 "80 and above", replace label define ageatinterview_dv_categories16 0 "16-19" 1 "20-34" 2 "35-49" 3 "50-64" 4 "65-79" 5 "80 and above", replace tab ageatinterview_dv_categories50, label tab ageatinterview_dv_categories16, label tabstat ageatinterview_dv, by(ageatinterview_dv_categories50) stats(min max) tabstat ageatinterview_dv, by(ageatinterview_dv_categories16) stats(min max) egen int ageentrypanel = min(ageatinterview_dv), by (pidp) * Creating cohortage from ageentrypanel - 5 years egen ageentrypanel_50plus5years = cut(ageentrypanel), at(50,55,60,65,70,75,80,105) icodes label egen ageentrypanel_16plus5years = cut(ageentrypanel), at(15,20,25,30,35,40,45,50,55,60,65,70,75,80,105) icodes label tabstat ageentrypanel, by(ageentrypanel_50plus5years) stats(min max) tabstat ageentrypanel, by(ageentrypanel_16plus5years) stats(min max) tab1 ageentrypanel_50plus5years ageentrypanel_16plus5years, mi nolabel gen byte ageentrypan_50plus5catce65to69 =ageentrypanel_50plus5years-3 gen byte ageentrypan_50plus5catce65to69sq =(ageentrypanel_50plus5years-3)^2 gen byte ageentrypan_16plus5catce45to49 =ageentrypanel_16plus5years-7 gen byte ageentrypan_16plus5catce45to49sq =(ageentrypanel_16plus5years-7)^2 recode ageentrypanel_50plus5years (1=0) (2=1) (3=1) (4/6=2), gen(ageentrypanel_3cat) * Creating cohortage from ageentrypanel - 9 years egen ageentrypanel_50plus9years = cut(ageentrypanel), at(50,59,68,77,86) icodes label tabstat ageentrypanel, by(ageentrypanel_50plus9years) stats(min max) tab ageentrypanel_50plus9years, mi nolabel gen byte ageentrypan_50plus9catce68to76=ageentrypanel_50plus9years-2 gen byte ageentrypan_50plus9catce68to76sq=(ageentrypanel_50plus9years-2)^2 * Descriptive statistics of individual data and control sum hconda* sum hcondna* sum healthconditionnumber_* sum healthconditionnumber_newstil_* sum disdif_mobilityFI-disdif_otherhealthproblemsFI disdif_anyhealthproblemsatall tab1 disdif_mobilityFI-disdif_otherhealthproblemsFI disdif_anyhealthproblemsatall, mi sum ageatinterview_dv_categories50 ageatinterview_dv_categories16 ageentrypanel ageentrypanel_50plus5years ageentrypan_50plus5catce65to69 ageentrypan_50plus5catce65to69sq ageentrypanel_3cat ageentrypanel_16plus5years ageentrypan_16plus5catce45to49 ageentrypan_16plus5catce45to49sq tab1 ageentrypan_50plus5catce65to69 ageentrypan_50plus5catce65to69sq ageentrypanel_16plus5years ageentrypan_16plus5catce45to49 ageentrypan_16plus5catce45to49sq interview_help_sought_other sum ageentrypanel_50plus9years ageentrypan_50plus9catce68to76 ageentrypan_50plus9catce68to76sq * Labeling * Age related variables label variable ageatinterview_dv "Age at interview" label variable ageatinterview_dv_categories50 "Age at the time of interview categories" label variable ageatinterview_dv_categories16 "Age at the time of interview categories starting 16" *label values ageatinterview_dv_categories ageatinterview_dv_categories_lab label variable ageentrypanel "Age at panelentry" label variable ageentrypanel_50plus5years "Age at panelentry 50 plus 5 year categories" label variable ageentrypan_50plus5catce65to69 "Age at panelentry 50 plus 5 year categories centered 65-69" label variable ageentrypan_50plus5catce65to69sq "Age at panelentry 50 plus 5 year categories centered 65-69 square" label variable ageentrypanel_3cat "Age at panelentry 3 categories" label define ageentrypanel_3cat_lab 0 "Age 50-54" 1 "Age 55-59" 2 "Age 60+" label values ageentrypanel_3cat ageentrypanel_3cat_lab label variable ageentrypanel_16plus5years "Age at panelentry 16 plus 5 year categories" label variable ageentrypan_16plus5catce45to49 "Age at panelentry 16 plus 5 year categories centered 45-49" label variable ageentrypan_16plus5catce45to49sq "Age at panelentry 16 plus 5 year categories centered 45-59 square" label variable ageentrypanel_50plus9years "Age at panelentry 50 plus 9 year categories" label variable ageentrypan_50plus9catce68to76 "Age at panelentry 50 plus 9 year categories centered 68-76" label variable ageentrypan_50plus9catce68to76sq "Age at panelentry 50 plus 9 year categories centered 68-76 square" * Interview related variables label variable interview_modus "Interview modus this individual was given (=indmode)" label variable interview_asproxy "Interview able to do as proxy (=iproxy)" label variable self_completion_accepted "Self completion accepted (=scac)" label variable self_completion_completed_dv "Self completion completed_dv (=scdata_dv)" label variable self_completion_flag_dv "Self completion flag_dv (=scflag_dv)" label define selfcompletionaccepted_lab -9 "missing" -8 "inapplicable" -7 "proxy" -2 "refusal" 1 "accepted as self-completion" 2 "acc sc by interviewer reading/sight problems" 3 "acc sc by interviewer language problems" 4 "refused self-completion" 5 "not able to do self-completion" label values self_completion_accepted selfcompletionaccepted_lab label variable sample_origin_individual "Sample origin" label define sample_origin_individual_lab 1 "UKHLS GB 2009-10" 2 "UKHLS NI 2009-10" 7 "EMB sample 2009-10" 8 "IEMB sample 2014-15" label values sample_origin_individual sample_origin_individual_lab label variable sex_dv_catnew "Sex" label variable interview_modus "Interview modus" label variable urbanruralresidence "Residence" * Control of interview variables sum gpsemb_csinterviewweight gpsemb_lsinterviewweight sum interview_modus interview_asproxy interview_help_sought_other sum self_completion_accepted self_completion_completed_dv self_completion_flag_dv sum self_completion_intervweightscus self_completion_intervweightscub self_completion_intervweightscui tab1 interview_modus interview_asproxy interview_help_sought_other tab1 self_completion_accepted self_completion_completed_dv self_completion_flag_dv drop jbendreas7 sex_dv symptoms8 * Controlling order pidp wave sample_origin_individual tab1 interview_modus self_completion_flag_dv ageatinterview_dv_categories50 ageatinterview_dv_categories16, nolabel tab ageatinterview_dv_categories50, label tab ageatinterview_dv_categories16, label compress save "$outpath/pidplongfileresp.dta", replace use "$outpath/pidplongfileresp.dta", clear ******************************************************************************** * Step 2b Nurse health assessment * Open the file for wave a and then add the rest of the waves specific files * Appending all individualresp files and creating one file use "$outpath/btempwaveindividual_healthassesment.dta", clear foreach w in c { append using "$outpath/`w'tempwaveindividual_healthassesment.dta" } sort pidp wave describe order pidp wave mdesc tab wave, label compress save "$outpath/pidplong_healthassesment.dta", replace ******************************************************************************** * Step 2c Nurse health assessment: blood use "$inpath/ukhls/xlabblood_ns.dta", clear sort pidp wave describe order pidp wave mdesc tab wave, label compress save "$outpath/pidplong_healthassesment_blood.dta", replace ******************************************************************************** * Step 2d Nurse health assessment: epigenetic clocks use "$inpath/ukhls/xepigen_clocks_ns.dta", clear sort pidp wave describe order pidp wave mdesc tab wave, label drop pid b_hidp b_pno b_splitnum c_hidp c_pno c_splitnum hhorig compress save "$outpath/pidplong_healthassesment_epigenclocks.dta", replace ******************************************************************************** * Step 3 * Adding info from individualall * Appending all individualall files and creating one file use "$outpath/atempwaveindividualall.dta", clear foreach w in b c d e f g h i j k l m { append using "$outpath/`w'tempwaveindividualall.dta" } sort pidp wave rename modetype interview_modustype rename intdaty_dv interviewdate_year_individual rename intdatm_dv interviewdate_month_individual * Descriptive statistics ***sum order pidp hidp agegr10_dv wave compress save "$outpath/pidplongfileindividualall.dta", replace * Adding info from xwavedat which is accross waves generated use "$inpath/ukhls/xwavedat.dta", clear sort pidp distinct pidp keep pidp birthy bornuk_dv dcsedfl_dv dcsedw_dv lwenum_dv lwintvd_dv ethn_dv_source fwintvd_dv generation psu strata sum tab1 birthy dcsedfl_dv dcsedw_dv lwenum_dv lwintvd_dv tab1 birthy dcsedfl_dv dcsedw_dv lwenum_dv lwintvd_dv, nolabel recode dcsedfl_dv (2/3=0) (1=1), gen(dead) rename dcsedw_dv deathinwaverecorded rename fwintvd_dv interview_waveentry_iser rename generation migration_generation rename lwenum_dv wave_last_enumerated rename lwintvd_dv wave_last_interviewed drop dcsedfl_dv label variable birthy "Birth year from xwavedat" label variable dead "Death event recorded in an UKHLS wave" label variable deathinwaverecorded "Death recorded in US wave" label variable interview_waveentry_iser "First wave interviewed (inc. proxy), (UKHLS) (fwintvd_dv)" label variable psu "Primary sampling unit (=psu)" label variable strata "Strata (=strata)" label variable wave_last_enumerated "Wave last enumerated" label variable wave_last_interviewed "Wave last interviewed" label values interview_waveentry_iser label define dead_lab 0 "No" 1 "Yes" label values dead dead_lab sum compress save "$outpath/individualxwavedat.dta", replace *********************************************************************************************************************************************************** * Step 4 * 4a) MERGING INDIVIDUAL LEVEL VARIABLES ONTO INDIVIDUAL LEVEL FILE now merged: individualresp: +individualall ************************************************************************************************************** use "$outpath/pidplongfileresp.dta", clear merge 1:1 pidp wave using "$outpath/pidplongfileindividualall.dta" tab _merge drop if (_merge==2 ) drop _merge save "$outpath/pidplongfile.dta", replace * 4b) MERGING INDIVIDUAL LEVEL VARIABLES ONTO INDIVIDUAL LEVEL FILE: now merged: individualresp: + individualall + xwavedat use "$outpath/pidplongfile.dta", clear merge m:1 pidp using "$outpath/individualxwavedat.dta" tab _merge drop if (_merge==2) drop _merge save "$outpath/pidplongfile.dta", replace ******************************************************************************** * 4c) MERGING INDIVIDUAL LEVEL VARIABLES ONTO INDIVIDUAL LEVEL FILE: now merged: individualresp: + individualall + xwavedat + FAQ_HCONDS v.20230526 use "$outpath/pidplongfile.dta", clear merge m:1 pidp using "$outpath/indresp_wave_j_hcondncode_hcondns_hcondever_hcondna_hospc_hospdc_reduced.dta" tab _merge drop if (_merge==2) drop _merge save "$outpath/pidplongfile.dta", replace ******************************************************************************** * 4d) MERGING INDIVIDUAL LEVEL VARIABLES ONTO INDIVIDUAL LEVEL FILE: now merged: individualresp: + individualall + xwavedat + FAQ_HCONDS v.20230526 + individualcovidsurvey use "$outpath/pidplongfile.dta", clear merge m:1 pidp using "$outpath/individualcovidsurvey.dta" tab _merge recode _merge (1/2=0) (3=1) ,gen(us_nhs_hes) tab us_nhs_hes *drop if (_merge==2) *list pidp wave sample_origin_individual drop _merge *drop healthdatalinkagew8 save "$outpath/pidplongfile.dta", replace ******************************************************************************** * 4e) Merge FI data and health assesment data: use "$outpath/pidplongfile.dta", clear merge 1:1 pidp wave using "$outpath/pidplong_healthassesment.dta" tab _merge drop if (_merge==2 ) drop _merge save "$outpath/pidplongfile.dta", replace tab wave ******************************************************************************** * 4f) Merge FI data and health assesment data: blood use "$outpath/pidplongfile.dta", clear merge 1:1 pidp wave using "$outpath/pidplong_healthassesment_blood.dta" tab _merge drop if (_merge==2 ) drop _merge save "$outpath/pidplongfile.dta", replace tab wave ******************************************************************************** * 4g) Merge FI data and health assesment data: epigenetic clocks use "$outpath/pidplongfile.dta", clear tab wave merge 1:1 pidp wave using "$outpath/pidplong_healthassesment_epigenclocks.dta" tab _merge drop if (_merge==2 ) drop _merge save "$outpath/pidplongfile.dta", replace tab wave ******************************************************************************** * Step 5 * Checking created LONG INDIVIDUAL LEVEL FILE use "$outpath/pidplongfile.dta", clear sort pidp wave tab1 deathinwaverecorded wave_last_enumerated wave_last_interviewed, mi tab1 deathinwaverecorded wave_last_enumerated wave_last_interviewed, mi nolabel * Death recorded in UKLS wave 20 should correspond to year 2010 (BHPS wave 2008 is wave 18) gen int deathinwaverecorded_new=deathinwaverecorded replace deathinwaverecorded_new=deathinwaverecorded_new-19 if inrange(deathinwaverecorded,20,30) mvdecode deathinwaverecorded_new, mv(-8=.b) tab1 deathinwaverecorded_new, mi * Death recorded in UKLS wave 20 should correspond to year 2010 (BHPS wave 2008 is wave 18) gen int deathyear=-1 replace deathyear= 2010 + (deathinwaverecorded - 20) if dead==1 gen int ageatdeath=deathyear - birthy if dead==1 & birthy!=-9 tab deathyear ***codebook ***labelbook *get rid of unwanted temporary files *foreach w in a b c d e f g h{ * erase `w'tempwaveindividual.dta *} tab1 deathinwaverecorded_new wave_last_enumerated wave_last_interviewed tab1 deathinwaverecorded_new wave_last_enumerated wave_last_interviewed, nolabel tab ageatdeath label variable ageatdeath "Age at death" label variable deathyear "Death year" drop deathinwaverecorded compress label variable deathinwaverecorded_new "death in wave recorded - recoded_new for corresponding to year 2010 " save "$outpath/pidplongfile.dta", replace gen hcond_asthma_agetoldna1st_diff= hcond_asthma_age_w1tola_minw10 - hcond_asthma_age_w1tola gen hcond_hyperte_agetoldna1st_diff= hcond_hyperte_age_w1tola_minw10 - hcond_hyperte_age_w1tola label variable hcond_asthma_agetoldna1st_diff "hcond_asthma_age_w1tola_minw10 - hcond_asthma_age_w1tola" label variable hcond_hyperte_agetoldna1st_diff "hcond_hyperte_age_w1tola_minw10 - hcond_hyperte_age_w1tola" sum hcond_asthma_agetoldna1st_diff hcond_hyperte_agetoldna1st_diff tab hcond_asthma_agetoldna1st_diff hist hcond_asthma_agetoldna1st_diff, subtitle("asthma: difference: hcond_hyperte_age_w1tola_minw10 - hcond_hyperte_age_w1tola") *********************************************************************************************************************************************************** *********************************************************************************************************************************************************** * Step 6 * COMBINING HOUSEHOLD DATASETS INTO LONG FORMAT WAVES: HOUSEHOLD LEVEL AND SEVERAL WAVES foreach w in a b c d e f g h i j k l m { // the commands between the curly breakets are executed for each element of // w (i.e., a b c d) in repeated iterations // In the 1st iteration Stata reads `w' as a, // In the 2nd iteration Stata reads `w' as b, and so on // (i) Extract the variables needed * `w'_sclfsato `w'_paygu_dv `w'_julkjb use "$inpath/ukhls/`w'_hhresp", clear isvar `w'_hidp `w'_emboost `w'_fihhmnnet1_dv keep `r(varlist)' compress // (ii) create a wave variable for appending the wave specific files into long format we need to gen byte wave = strpos("abcdefghijkl","`w'") // (iii) drop the wave prefix from all variables that had one rename `w'_* * // save each wave specific file compress save "$outpath/`w'tempwavehousehold.dta", replace } ******************************************************************************** * Step 7 * Combining houshold datasets into long format: houshold level fom several waves // Open the file for wave a and then add the rest of the wave specific files use "$outpath/atempwavehousehold.dta", clear foreach w in b c d e f g h i j k l m { append using "$outpath/`w'tempwavehousehold.dta" } sort hidp wave * Renaming rename fihhmnnet1_dv hhincomenet_dv rename emboost hhethnicminoritysample_dv * Descriptive statistics label variable hhincomenet_dv "Total household net income with no deductions" compress save "$outpath/hidplongfile.dta", replace *************************************** use "$outpath/hidplongfile.dta", clear compress save "$outpath/hidplongfile.dta", replace // get rid of unwanted temporary files *foreach w in a b c d e f g h{ * erase `w'tempwavehousehold.dta *} *********************************************************************************************************************************************************** *********************************************************************************************************************************************************** * Step 8: Merging and combining household level and individual level files + mergin BHPS + descriptive statics before mvdecode * A) MERGE HOUSEHOLD LEVEL VARIABLES AND INDIVIDUAL LEVEL VARIABLES INTO ONE FILE **************************************************************** use "$outpath/pidplongfile.dta", clear merge m:1 hidp wave using "$outpath/hidplongfile.dta" tab _merge sort _merge tab individinterview_proxy_catnew drop if (_merge==2) drop _merge sort pidp wave hidp * Construction of a variable gen int agein2010 = 2010 - birthy * Generated birthy variable is missing in about 30 cases tab agein2010, missing replace agein2010=ageatinterview_dv - (interviewdate_year_individual - 2010) if birthy==. tab agein2010 tab1 birthy us_nhs_hes healthdatalinkagew8, m sum agein2010 # delimit ; order pidp hidp psu strata wave us_nhs_hes healthdatalinkagew8 interview_modus interview_modustype interview_asproxy interview_help_sought_other self_completion_flag_dv self_completion_completed_dv self_completion_accepted gpsemb_csinterviewweight gpsemb_lsinterviewweight self_completion_intervweightscub self_completion_intervweightscui self_completion_intervweightscus fed_forward_interv_outcome_iser fed_forward_ever_interv_iser interview_waveentry_iser sample_origin_household sample_origin_individual hhethnicminoritysample_dv individinterview_proxy_catnew interviewstartdate_year interviewdate_year_individual interviewdate_month_individual countryofresidence sex_dv_catnew ethn_dv ethn_dv_source racel_dv bornuk_dv migration_generation birthy ageentrypanel ageentrypanel_50plus5years ageentrypan_50plus5catce65to69 ageentrypan_50plus5catce65to69sq ageentrypanel_3cat ageentrypanel_16plus5years ageentrypan_16plus5catce45to49 ageentrypan_16plus5catce45to49sq ageentrypanel_50plus9years ageentrypan_50plus9catce68to76 ageentrypan_50plus9catce68to76sq ageatinterview_dv ageatinterview_dv_sq agein2010 agegr10_dv ageatinterview_dv_categories50 ageatinterview_dv_categories16 dead ageatdeath deathinwaverecorded_new wave_last_enumerated wave_last_interviewed deathyear education_highest education_highest_flag_asked mastat_dv cohab_dv bmi_dv numbercigarettes economicactivivity_current jobcurrent_nssec_classification jobcurrent_nssec_classification3 urbanruralresidence hospitalinpatient_yn hospitalinpatient_days hhincomenet_dv hcond_hf_hcond hcond_chd_hcond hcond_angina_hcond hcond_hatmi_hcond hcond_stroke_hcond hcond_hyperte_hcond hcond_asthma_hcond hcond_copd_hcond hcond_arthr_hcond hcond_emphys_hcond hcond_hypothy_hcond hcond_bron_hcond hcond_diab_hcond hcond_liver_hcond hcond_malig_hcond hcond_emnervpsychproblem hcond_mhdepression_hcond hcond_emnervpsychproblem_hcond hcond_epilep_hcond hcond_hf_still hcond_chd_still hcond_angina_still hcond_hatmi_still hcond_stroke_still hcond_hyperte_still hcond_asthma_still hcond_copd_still hcond_arthr_still hcond_emphys_still hcond_hypothy_still hcond_bron_still hcond_diab_still hcond_liver_still hcond_malig_still hcond_epilep_still hcond_longstandill_hcond healthconditionnumber_1 healthconditionnumber_newstil_1 healthconditionnumber_2 healthconditionnumber_newstil_2 healthconditionnumber_3 healthconditionnumber_newstil_3 healthconditionnumber_4 healthconditionnumber_newstil_4 healthconditionnumber_5 healthconditionnumber_newstil_5 healthconditionnumber_6 healthconditionnumber_newstil_6 healthconditionnumber_7 healthconditionnumber_newstil_7 healthconditionnumber_8 healthconditionnumber_newstil_8 healthconditionnumber_9 healthconditionnumber_newstil_9 healthconditionnumber_10 healthconditionnumber_newstil_10 healthconditionnumber_11 healthconditionnumber_newstil_11 healthconditionnumber_12 healthconditionnumber_newstil_12 healthconditionnumber_13 healthconditionnumber_newstil_13 hcond_asthma_age_w1tola hcond_arthr_age_w1to9 hcond_hf_age_w1tola hcond_chd_age_w1tola hcond_angina_age_w1tola hcond_hatmi_age_w1tola hcond_stroke_age_w1tola hcond_emphys_age_w1tola hcond_hypothy_age_w1tola hcond_bron_age_w1tola hcond_liver_age_w1tola hcond_malig_age_w1to9 hcond_diab_age_w1to9 hcond_epilep_age_w1tola hcond_hyperte_age_w1tola hcond_copd_age_w10tola hcond_depress_age_w10to12 hcond_arthrosteo_w10plus_age hcond_arthrheum_w10plus_age hcond_maliglung_w10plus_age hcond_maligbreast_w10plus_age hcond_maligprost_w10plus_age hcond_maligliver_w10plus_age hcond_maligskin_w10plus_age hcond_diabettyp1_w10plus_age hcond_diabettyp2_w10plus_age hcond_diabettypge_w10plus_age hcond_heartattack_inw3_agetold hcond_stroke_inw3_agetold disdif_mobilityFI disdif_movingobjectsFI disdif_manualdexterityFI disdif_continenceFI disdif_hearingFI disdif_sightFI disdif_communicationFI disdif_concentratingabbilityFI disdif_recognisingdangerFI disdif_physicalcoordinationFI disdif_difficultiescareFI disdif_otherhealthproblemsFI disdif_anyhealthproblemsatall scs_generalhealth_scsf1_sc scs_generalhealth_sf1_f2f scs_hl_moderateactivities scs_hl_climbingstairs scs_hl_work scs_hl_kindofwork scs_hl_emotionalprob_laccomplish scs_hl_emotionalprob_lesscareful scs_hl_painwork scs_hl_feeling_calm scs_hl_having_enery scs_hl_feeling_depressed scs_hl_emotionalprobsocialact sf2a_hl_moderateactivities sf2b_hl_climbingstairs sf3a_hl_work sf3b_hl_kindofwork sf4a_hl_emotionalprob_laccomplis sf4b_hl_emotionalprob_lesscarefu sf5_hl_painwork sf6a_hl_feeling_calm sf6b_hl_having_enery sf6c_hl_feeling_depressed sf7_hl_emotionalprobsocialact scl_lifesatisfactionverall scl_healthsatisfaction ghq_concentration ghq_lossofsleep ghq_usefulrole ghq_capablemakingdecisions ghq_constantlyunderstrain ghq_problemovercomdifficulties ghq_enjoydaytodayactivities ghq_abilitytofaceproblems ghq_unhappyordepressed ghq_losingconfidence ghq_believeinselfworth ghq_generalhappiness scorementalhealthcomp scorephysicalhealthcomp subjwellbeing_GHQLikertstatus subjwellbeing_GHQCasenessstatus alonelinessfeeling dissev_memorydifficulty adl_ability_managestairs adl_eaeof_managestairs adl_ability_getaroundhouse adl_easeof_getaroundhouse adl_ability_getinoutofbed adl_easeof_getinoutofbed adl_ability_cuttoenails adl_easeof_cuttoenails adl_ability_bathshower adl_easeof_bathshower adl_ability_walkdownroad adl_easeof_walkdownroad adl_ability_usetoilet adl_easeof_usetoilet adl_ability_eat adl_easeof_eat adl_ability_washfaceandhands adl_easeof_washfaceandhands adl_ability_getdressed adl_easeof_getdressed adl_ability_takerightmedicines adl_easeof_takerightmedicines adl_ability_doshopping adl_easeof_doshopping adl_ability_laundryhousework adl_easeof_laundryhousework adl_ability_paperwork adl_easeof__paperwork scun_eyesightproblems scun_readingproblems scun_languageproblems scun_otherproblems drugcannabis druggluesolventsniffing drugsother visit_gplast12months visit_hospitallast12months visit_hospitalindays sc_sleepinhours sc_sleepinminutes sc_sleepwithin30minute_yn sc_sleepwakeupnight_yn sc_sleepcoughsnore sc_sleeppill sc_awakestayingtrouble sc_sleepquality tslp_wakeupinthenight tsta_troublestayingawakedurday hcond_depress_age_w10to12 mabroad mnabroad mindirect mnotherc mreturned mlived mnlived moveage medcnjd tbmed statins statina_med folic folpreghr lipid_med iron_med medtyp1 medtyp2 medtyp3 medtyp4 medtyp5 medtyp6 medtyp7 medtyp8 medtyp9 medtyp10 medtyp11 medtyp12 medtyp13 medcnj resphts height estht weight bfpc bfpcval estwt relwaitb respbps mmgswil mmgsdval mmgsnval mmgsdom mmgssta mmgsd1 mmgsn1 mmgsd2 mmgsn2 mmgsd3 mmgsn3 mmgstp mmgsres htfvc htfev htpef htfevfvc htfvc_sc htfev_sc htpef_sc htfevfvc_sc bprespc waist1 waist2 waist3 wstokb wstval bmi bmival hyper1 hyper2 dord dory dorm alb alkp alt ast chol dheas ecre ggt hba1c hdl hscrp igfi rtin testo trig ure hgb cfib uscmg uscmm cmvavc hhorig indbdub_xw horvath2013_clock hannum_clock phenoage_clock horvath_sb_clock lin_clock belsky_dunedinpoam belsky_clock cd8t cd4t nk bcell mono gran /*sample barcode*/ ; # delimit cr sort pidp wave tab2 hhethnicminoritysample_dv wave * Labeling label variable ageatinterview_dv_categories50 "Age in categories" label variable ageatinterview_dv_categories16 "Age in categories" label variable ageentrypanel "Age at panel entry" /*"Age at panel entry (=cohortage in reg)"*/ label variable agein2010 "Age in 2010" label variable hcond_longstandill_hcond "Disease or long-standing illness or impairment" drop individinterview_proxy drop healthconditionnumber_* compress save "$outpath/pidphidplongfile.dta", replace * Replacing missing hhethnicminoritysample_dv because only in the first wave use "$outpath/pidphidplongfile.dta", clear tab hhethnicminoritysample_dv, missing tab sample_origin_individual, missing tab sample_origin_household, missing * Second collapse collapse (max) hhethnicminoritysample_dv, by(pidp) tab hhethnicminoritysample_dv, missing replace hhethnicminoritysample_dv=0 if hhethnicminoritysample_dv==. tab hhethnicminoritysample_dv save "$outpath/pidphidplongfilehhethnicminoritysample_dv_collapsed.dta", replace * Replacing missing hhethnicminoritysample_dv because only in the first wave use "$outpath/pidphidplongfile.dta", clear merge m:1 pidp using "$outpath/pidphidplongfilehhethnicminoritysample_dv_collapsed.dta", update tab _merge drop _merge tab hhethnicminoritysample_dv, missing sort pidp wave hidp sum scs_generalhealth_scsf1_sc scs_generalhealth_sf1_f2f scs_hl_moderateactivities if sample_origin_household==1 & wave==6 compress save "$outpath/pidphidplongfile.dta", replace **************************** * A) MERGE BHPS into US * Merge if necesary BHPS data **************************************************************** use "$outpath/pidplongfile.dta", clear save "$outpath/pidplongfile_usbhps.dta", replace ******************************************************************************** ******************************************************************************** * Frailty index related variables /***** *****/ use "$outpath/pidphidplongfile.dta", clear tab1 wave sample_origin_household ******************************************************************************** * Step 9: Using mvdecode for missings and recoding before FI *Recoding certain variables for construction of the frailty index (FI) and using descriptive statistics as control of for further used variables use "$outpath/pidphidplongfile.dta", clear tab1 ageatinterview_dv bornuk_dv dead education_highest_flag_asked ethn_dv mastat_dv sex_dv_catnew dead, mi nolabel tab1 bornuk_dv education_highest mastat_dv, mi tab1 bornuk_dv education_highest mastat_dv, mi nolabel tab wave foreach var of varlist hcond_angina_hcond hcond_arthr_hcond hcond_asthma_hcond hcond_bron_hcond hcond_cdepress_hcond hcond_chd_hcond hcond_copd_hcond hcond_diab_hcond hcond_emphys_hcond hcond_epilep_hcond hcond_hatmi_hcond hcond_hiv_hcond hcond_hyperte_hcond hcond_hyperthy_hcond hcond_hypothy_hcond hcond_hf_hcond hcond_liver_hcond hcond_malig_hcond hcond_ms_hcond hcond_stroke_hcond { gen byte `var'OC =`var' label variable `var'OC "hcond original coding `var' " } # delimit; mvdecode pidp hidp psu strata wave fed_forward_interv_outcome_iser fed_forward_ever_interv_iser interview_waveentry_iser sample_origin_individual sample_origin_household hhethnicminoritysample_dv individinterview_proxy_catnew interviewstartdate_year interviewdate_year_individual interviewdate_month_individual countryofresidence sex_dv_catnew ethn_dv ethn_dv_source racel_dv migration_generation birthy ageentrypanel agein2010 agegr10_dv ageatinterview_dv_categories50 ageatinterview_dv_categories16 dead ageatdeath deathinwaverecorded_new wave_last_enumerated wave_last_interviewed deathyear cohab_dv bmi_dv numbercigarettes economicactivivity_current jobcurrent_nssec_classification jobcurrent_nssec_classification3 urbanruralresidence hospitalinpatient_yn hospitalinpatient_days hhincomenet_dv hcond_angina_hcond hcond_arthr_hcond hcond_asthma_hcond hcond_bron_hcond hcond_cdepress_hcond hcond_chd_hcond hcond_copd_hcond hcond_diab_hcond hcond_emnervpsychproblem_hcond hcond_emphys_hcond hcond_epilep_hcond hcond_hatmi_hcond hcond_hf_hcond hcond_hiv_hcond hcond_hyperte_hcond hcond_hyperthy_hcond hcond_hypothy_hcond hcond_liver_hcond hcond_malig_hcond hcond_mhdepression_hcond hcond_ms_hcond hcond_stroke_hcond hcond_hf_still hcond_chd_still hcond_angina_still hcond_hatmi_still hcond_stroke_still hcond_hyperte_still hcond_asthma_still hcond_copd_still hcond_arthr_still hcond_emphys_still hcond_hypothy_still hcond_bron_still hcond_diab_still hcond_liver_still hcond_malig_still hcond_epilep_still hcond_longstandill_hcond hcond_chrhcondother_still sf2a_hl_moderateactivities sf2b_hl_climbingstairs sf3a_hl_work sf3b_hl_kindofwork sf4a_hl_emotionalprob_laccomplis sf4b_hl_emotionalprob_lesscarefu sf5_hl_painwork sf6a_hl_feeling_calm sf6b_hl_having_enery sf6c_hl_feeling_depressed sf7_hl_emotionalprobsocialact scl_lifesatisfactionverall scl_healthsatisfaction ghq_concentration ghq_lossofsleep ghq_usefulrole ghq_capablemakingdecisions ghq_constantlyunderstrain ghq_problemovercomdifficulties ghq_enjoydaytodayactivities ghq_abilitytofaceproblems ghq_unhappyordepressed ghq_losingconfidence ghq_believeinselfworth ghq_generalhappiness scorementalhealthcomp scorephysicalhealthcomp subjwellbeing_GHQLikertstatus subjwellbeing_GHQCasenessstatus alonelinessfeeling dissev_memorydifficulty adl_ability_managestairs adl_eaeof_managestairs adl_ability_getaroundhouse adl_easeof_getaroundhouse adl_ability_getinoutofbed adl_easeof_getinoutofbed adl_ability_cuttoenails adl_easeof_cuttoenails adl_ability_bathshower adl_easeof_bathshower adl_ability_walkdownroad adl_easeof_walkdownroad adl_ability_usetoilet adl_easeof_usetoilet adl_ability_eat adl_easeof_eat adl_ability_washfaceandhands adl_easeof_washfaceandhands adl_ability_getdressed adl_easeof_getdressed adl_ability_takerightmedicines adl_easeof_takerightmedicines adl_ability_doshopping adl_easeof_doshopping adl_ability_laundryhousework adl_easeof_laundryhousework adl_ability_paperwork adl_easeof__paperwork scun_eyesightproblems scun_readingproblems scun_languageproblems scun_otherproblems drugcannabis druggluesolventsniffing drugsother visit_gplast12months visit_hospitallast12months visit_hospitalindays sc_sleepinhours sc_sleepinminutes sc_sleepwithin30minute_yn sc_sleepwakeupnight_yn sc_sleepcoughsnore sc_sleeppill sc_awakestayingtrouble sc_sleepquality tslp_wakeupinthenight tsta_troublestayingawakedurday hcond_noneoflisted_hcond hcond_angina_newwave2to9 hcond_arthr_newwave2to9 hcond_asthma_newwave2to9 hcond_bron_newwave2to9 hcond_cdepress_newwave2to9 hcond_chd_newwave2to9 hcond_diab_newwave2to9 hcond_emphys_newwave2to9 hcond_epilep_newwave2to9 hcond_hatmi_newwave2to9 hcond_hf_newwave2to9 hcond_hiv_newwave2to9 hcond_hyperte_newwave2to9 hcond_hypothy_newwave2to9 hcond_liver_newwave2to9 hcond_malig_newwave2to9 hcond_ms_newwave2to9 hcond_stroke_newwave2to9 hcond_noneoflisted_newwave2to9 hcond_hatmi_everinw3 hcond_stroke_everinw3 hcond_noneoflisted_everinw3 hcond_angina_hcondw10p hcond_asthma_hcondw10p hcond_bron_hcondw10p hcond_chd_hcondw10p hcond_copd_hcondw10p hcond_emphys_hcondw10p hcond_epilep_hcondw10p hcond_hatmi_hcondw10p hcond_hf_hcondw10p hcond_hiv_hcondw10p hcond_hyperte_hcondw10p hcond_hypothy_hcondw10p hcond_liver_hcondw10p hcond_stroke_hcondw10p hcond_psychprobother_hcond hcond_chrhcondother_hcondw10p hcond_noneoflisted_hcondw10p hcond_angina_newwave10p hcond_asthma_newwave10p hcond_bron_newwave10p hcond_chd_newwave10p hcond_copd_newwave10p hcond_emphys_newwave10p hcond_epilep_newwave10p hcond_hatmi_newwave10p hcond_hf_newwave10p hcond_hiv_newwave10p hcond_hyperte_newwave10p hcond_hypothy_newwave10p hcond_liver_newwave10p hcond_stroke_newwave10p hcond_arthoesto_newwave10p hcond_arthrheum_newwave10p hcond_arthother_newwave10p hcond_maligcolon_newwave10p hcond_maliglung_newwave10p hcond_maligbreast_newwave10p hcond_maligprostata_newwave10p hcond_maligliver_newwave10p hcond_maligskin_newwave10p hcond_maligother_newwave10p hcond_diabetestyp1_newwave10p hcond_diabetestyp2_newwave10p hcond_diabetestypge_newwave10p hcond_diabetestypot_newwave10p hcond_psychprobother_hcondw10p hcond_chrhcondother_newwave10p hcond_nonelisted_newwave10p hcond_angina_everinw10 hcond_arthr_everinw10 hcond_asthma_everinw10 hcond_bron_everinw10 hcond_chd_everinw10 hcond_copd_everinw10 hcond_diab_everinw10 hcond_emnervpsyprob_everinw10 hcond_emphys_everinw10 hcond_epilep_everinw10 hcond_hatmi_everinw10 hcond_hf_everinw10 hcond_hiv_everinw10 hcond_hyperte_everinw10 /*hcond_hyperthy_everinw10*/ hcond_hypothy_everinw10 hcond_liver_everinw10 hcond_malig_everinw10 hcond_ms_everinw10 hcond_stroke_everinw10 hcond_chrhcondother_everinw10 hcond_noneoflisted_everinw10 hcond_angina_newwave11p hcond_arthr_newwave11p hcond_asthma_newwave11p hcond_bron_newwave11p hcond_chd_newwave11p hcond_copd_newwave11p hcond_diab_newwave11p hcond_emnervpsych_newwave11p hcond_emphys_newwave11p hcond_epilep_newwave11p hcond_hatmi_newwave11p hcond_hf_newwave11p hcond_hiv_newwave11p hcond_hyperte_newwave11p hcond_hypothy_newwave11p hcond_liver_newwave11p hcond_malig_newwave11p hcond_ms_newwave11p hcond_stroke_newwave11p hcond_chrhcondother_newwave11p hcond_noneoflisted_newwave11p medcnjd tbmed statins statina_med folic folpreghr lipid_med iron_med medtyp1 medtyp2 medtyp3 medtyp4 medtyp5 medtyp6 medtyp7 medtyp8 medtyp9 medtyp10 medtyp11 medtyp12 medtyp13 medcnj resphts height estht weight bfpc bfpcval estwt relwaitb respbps mmgswil mmgsdval mmgsnval mmgsdom mmgssta mmgsd1 mmgsn1 mmgsd2 mmgsn2 mmgsd3 mmgsn3 mmgstp mmgsres htfvc htfev htpef htfevfvc htfvc_sc htfev_sc htpef_sc htfevfvc_sc bprespc waist1 waist2 waist3 wstokb wstval bmi bmival hyper1 hyper2 dord dory dorm alb alkp alt ast chol dheas ecre ggt hba1c hdl hscrp igfi rtin testo trig ure hgb cfib uscmg uscmm cmvavc hhorig indbdub_xw horvath2013_clock hannum_clock phenoage_clock horvath_sb_clock lin_clock belsky_dunedinpoam belsky_clock sample barcode cd8t cd4t nk bcell mono gran mabroad mnabroad mindirect mnotherc mreturned mlived mnlived moveage, mv(-41=.f\ -32=.e\ -31=.e\ -22=.d\ -11=.c\ -9=.b\ -8=.b\ -7=.b\ -2=.a\ -1=.a) ; #delimit cr recode healthdatalinkagew8 (-9=0) (-8=0) (-7=0) (-2=0) (-1=0) (.=0) (2=0) * FI disabilities and difficulties domain * For disdif original mv(-10=. \ -9=.b \ -7=.b \ -2=.a \ -1=.a) tab1 disdif_mobilityFI-disdif_otherhealthproblems, mi mvdecode disdif_mobilityFI disdif_movingobjectsFI disdif_manualdexterityFI disdif_continenceFI disdif_hearingFI disdif_sightFI disdif_communicationFI disdif_concentratingabbilityFI disdif_recognisingdangerFI disdif_physicalcoordinationFI disdif_difficultiescareFI disdif_otherhealthproblemsFI disdif_anyhealthproblemsatall, mv(-10=. \ -9=. \ -7=. \ -2=. \ -1=.) * For disdif original mv(-8=0) *-8 coded as 0 different to hond recode disdif_mobilityFI disdif_movingobjectsFI disdif_manualdexterityFI disdif_continenceFI disdif_hearingFI disdif_sightFI disdif_communicationFI disdif_concentratingabbilityFI disdif_recognisingdangerFI disdif_physicalcoordinationFI disdif_difficultiescareFI disdif_otherhealthproblemsFI disdif_anyhealthproblemsatall (-8=0) tab1 disdif_mobilityFI-disdif_otherhealthproblemsFI, mi * Tabulation disdif by wave tab2 (disdif_mobilityFI-disdif_otherhealthproblemsFI) wave, mi * Control FI candidates after recoding foreach var of varlist disdif_mobilityFI-disdif_otherhealthproblemsFI { tab2 `var' wave, mi } *"Not available for the IEMBS" - Some questions were only asked in the W6 questionnaire for non-IEMBS and so individuals in IEMBS will have missing information for these variable mvdecode fed_forward_interv_outcome_iser, mv(-10=.c) * Different recoding for age onset variables of health conditions mvdecode hcond_angina_age_w1tola_minw10 hcond_arthr_age_w1tola_minw10 hcond_asthma_age_w1tola_minw10 hcond_chd_age_w1tola_minw10 hcond_bron_age_w1tola_minw10 hcond_hf_age_w1tola_minw10 hcond_copd_age_w10tola_minw10 hcond_diab_age_w1tola_minw10 hcond_emphys_age_w1tola_minw10 hcond_epilep_age_w1tola_minw10 hcond_hatmi_age_w1tola_minw10 hcond_hyperte_age_w1tola_minw10 /*hcond_hyperthy_age_w1tola_minw10*/ hcond_hypothy_age_w1tola_minw10 hcond_liver_age_w1tola_minw10 hcond_malig_age_w1tola_minw10 hcond_ms_age_w1tola_minw10 hcond_stroke_age_w1tola_minw10 hcond_arthoesto_age_na hcond_arthrheum_age_na hcond_diabetestyp1_age_na hcond_diabetestyp2_age_na hcond_diabetestypge_age_na hcond_diabetestypot_age_na hcond_maligbreast_age_na hcond_maligcolon_age_na hcond_maliglung_age_na hcond_maligprost_age_na hcond_maligskin_age_na , mv(-9=. \ -8=. \ -7=. \ -2=. \ -1=.) mvdecode hcond_heartattack_inw3_agetold hcond_stroke_inw3_agetold, mv(-8=. \ -7=. \ -2=. \ -1=.) mvdecode hcond_angina_age_w1tola hcond_asthma_age_w1tola hcond_bron_age_w1tola hcond_chd_age_w1tola hcond_copd_age_w10tola hcond_emphys_age_w1tola hcond_epilep_age_w1tola hcond_hatmi_age_w1tola hcond_hf_age_w1tola hcond_hiv_age_w7tola hcond_hyperte_age_w1tola hcond_hyperthy_age_w1tola hcond_hypothy_age_w1tola hcond_liver_age_w1tola hcond_ms_age_w1tola hcond_stroke_age_w1tola, mv(-9=. \ -8=. \ -7=. \ -2=. \ -1=.) mvdecode hcond_arthr_age_w1to9 hcond_diab_age_w1to9 hcond_malig_age_w1to9, mv(-9=. \ -8=. \ -7=. \ -2=. \ -1=.) mvdecode hcond_arthrosteo_w10plus_age hcond_arthrheum_w10plus_age hcond_maliglung_w10plus_age hcond_maligbreast_w10plus_age hcond_maligprost_w10plus_age hcond_maligliver_w10plus_age hcond_maligskin_w10plus_age hcond_diabettyp1_w10plus_age hcond_diabettyp2_w10plus_age hcond_diabettypge_w10plus_age, mv(-8=. \ -7=. \ -2=. \ -1=.) * Recode FI disease variables missings -8 but not . recode hcond_longstandill_hcond (2=0) * Disease *_hcond *_ever *_inw3 mvdecode hcond_*_hcond, mv(-8=.b) * newwave2to9 recode hcond_*_newwave2to9 (-10=0) (-8=0) mdesc hcond_asthma_newwave2to9 * hcond_*_hcondw10p recode hcond_*_hcondw10p (-8=0) * newwave10to12: subcategories recode hcond_maligcolon_newwave10p hcond_maliglung_newwave10p hcond_maligbreast_newwave10p hcond_maligprostata_newwave10p hcond_maligliver_newwave10p hcond_maligskin_newwave10p hcond_maligother_newwave10p hcond_diabetestyp1_newwave10p hcond_diabetestyp2_newwave10p hcond_diabetestypge_newwave10p hcond_diabetestypot_newwave10p (-8=0) (-7=0) (.=0) * Arthritis gen byte hcondcode2=0 replace hcondcode2=1 if (hcond_arthoesto_newwave10p==1 | hcond_arthrheum_newwave10p==1 | hcond_arthother_newwave10p==1) rename hcondcode2 hcond_arthr_hcondw10p * replacing hcondage for arthritis and waves from 10+ (only oestoarthritis info) egen byte hcond_arthr_w10plus_age= rowmin(hcond_arthrosteo_w10plus_age hcond_arthrheum_w10plus_age) gen byte hcond_arthr_age_w1tola=hcond_arthr_age_w1to9 replace hcond_arthr_age_w1tola=hcond_arthr_w10plus_age if wave>=10 * Updating diseases * Malignancy gen byte hcondcode13=0 replace hcondcode13=1 if (hcond_maligcolon_newwave10p==1 | hcond_maliglung_newwave10p==1 | hcond_maligbreast_newwave10p==1 | hcond_maligprostata_newwave10p==1 | hcond_maligliver_newwave10p==1 | hcond_maligskin_newwave10p==1 | hcond_maligother_newwave10p==1) rename hcondcode13 hcond_malig_hcondw10p * replacing hcondage for malignancy and waves from 10+ egen byte hcond_malig_w10plus_age= rowmin(hcond_maligbreast_w10plus_age hcond_maligliver_w10plus_age hcond_maliglung_w10plus_age hcond_maligprost_w10plus_age hcond_maligskin_w10plus_age) gen byte hcond_malig_age_w1tola=hcond_malig_age_w1to9 replace hcond_malig_age_w1tola=hcond_malig_w10plus_age if wave>=10 * Diabetes gen byte hcondcode14=0 replace hcondcode14=1 if (hcond_diabetestyp1_newwave10p==1 | hcond_diabetestyp2_newwave10p==1 | hcond_diabetestypge_newwave10p==1 | hcond_diabetestypot_newwave10p==1) rename hcondcode14 hcond_diab_hcondw10p * replacing hcondage for diabetes and waves from 10+ egen byte hcond_diab_w10plus_age= rowmin(hcond_diabettyp1_w10plus_age hcond_diabettyp2_w10plus_age hcond_diabettypge_w10plus_age) gen byte hcond_diab_age_w1tola=hcond_diab_age_w1to9 replace hcond_diab_age_w1tola=hcond_diab_w10plus_age if wave>=10 * Control mdesc hcond_*_hcond hcond_*_age_w1tola hcond_*_hcondw10p *_newwave2to9 *_newwave10p hcond_*_w10plus_age sum hcond_*_hcond hcond_*_age_w1tola hcond_*_hcondw10p *_newwave2to9 *_newwave10p hcond_*_w10plus_age tab1 bornuk_dv education_highest mastat_dv, mi * Recoding education, ethnicity, marriage status tab1 education_highest ethn_dv mastat_dv, mi tab1 education_highest ethn_dv mastat_dv, mi nolabel * BMI Krishnan Bhaskaran et al. 2018: pausible values 15-50 *replace bmi_dv *************************** * Special Recoding negative values of bornuk_dv ethn_dv mastat_dv *Change ageatinterview_dv recode ageatinterview_dv (-9=.) recode sex_dv_catnew (-9=.) *Change bornuk_dv mvencode bornuk_dv, mv(.=-99) /*Real missings*/ recode bornuk_dv (-9=-99) /*Other missings*/ tab1 bornuk_dv, mi tab1 bornuk_dv, mi nolabel recode bornuk_dv (2=0 "No") (1=1 "Yes") (-99=-99 "Missing"), prefix(new) label(newbornuk_dv) label variable newbornuk_dv "Born in the UK" tab1 newbornuk_dv, mi tab1 newbornuk_dv, mi nolabel * Change education education_highest recode education_highest -9=.b recode education_highest -8=-88 mvencode education_highest, mv(100) tab1 education_highest, mi tab1 education_highest, mi nolabel recode education_highest (1/6=1) (7/12=2) (13/16=3) (96=0) (-88=100) (100=100) , gen(education_highest_catnew) label variable education_highest_catnew "Highest level education" label define education_highest_catnew_lab 0 "None of the above" 1 "University/higher edu." 2 "A-levels" 3 "O-levels" 100 "Missing" /*-88 "inapplicable"*/ label value education_highest_catnew education_highest_catnew_lab tab1 education_highest_catnew, mi * Change ethnicity ethn_dv recode ethn_dv (-9=.b) mvencode ethn_dv, mv(100) recode ethn_dv (1/2=1) (4=1) (9=2) (10=3) (11=4) (14=5) (15=6) (3=10) (12=10) (5/8=11) (13=10) (16/17=10) (97=10) (100=.b) , gen(ethn_dv_catnew) recode ethn_dv (100=.b) label variable ethn_dv_catnew "Ethnicity" label define ethn_dv_catnew_label 1 "White (ref.)" 2 "Indian" 3 "Pakistani" 4 "Bangladeshi" 5 "Caribbean" 6 "African" 10 "Other" 11 "Mixed" 100 "Missing" /*"Other(Gypsy/Chinese/Any other ethnic/Asian/Black/Arab background)"*/ label value ethn_dv_catnew ethn_dv_catnew_label tab mastat_dv, mi nolabel recode mastat_dv -1=.a recode mastat_dv -2=.a recode mastat_dv -9=.b recode mastat_dv -8=.b mvencode mastat_dv, mv(100) recode mastat_dv (1=0) (2/3=1) (4/9=0) (10=1) (100=100), gen(mastat_dv_catnew) label variable mastat_dv_catnew "Partnership status" label define mastat_dv_catnew_lab 0 "No partnership" 1 "Partnership" 100 "Missing" label value mastat_dv_catnew mastat_dv_catnew_lab tab1 ageatinterview_dv education_highest_catnew ethn_dv_catnew mastat_dv_catnew, mi tab1 ageatinterview_dv education_highest_catnew ethn_dv_catnew mastat_dv_catnew, mi nolabel gen byte missing_covariate=0 replace missing_covariate=1 if (ageatinterview_dv==.) | (education_highest_catnew==100) | (ethn_dv_catnew==100) | (mastat_dv_catnew==100) | (sex_dv_catnew==.) label variable missing_covariate "Missing covariate" tab1 missing_covariate, mi * HH-income replace hhincomenet_dv=0 if hhincomenet_dv<0 * Missing covariate mdesc ageatinterview_dv education_highest_catnew ethn_dv_catnew mastat_dv_catnew sex_dv_catnew tab1 ageatinterview_dv education_highest_catnew ethn_dv_catnew mastat_dv_catnew sex_dv_catnew, mi tab1 ageatinterview_dv education_highest_catnew ethn_dv_catnew mastat_dv_catnew sex_dv_catnew, mi nolabel * Covariates *****tab1 education_highest_catnew ethn_dv_catnew mastat_dv_catnew, mi nolabel *****tab1 education_highest_catnew ethn_dv_catnew mastat_dv_catnew, mi label * Updating from two variables into one: w1-w9 and w10-w12 ************************************* * Hcond Loop * Initialisation foreach var of newlist hcond_asthma_updatew2tolast hcond_arthr_updatew2tolast hcond_hf_updatew2tolast hcond_chd_updatew2tolast hcond_angina_updatew2tolast hcond_hearttmi_updatew2tolast hcond_stroke_updatew2tolast hcond_emphys_updatew2tolast hcond_hypothy_updatew2tolast hcond_bron_updatew2tolast hcond_diab_updatew2tolast hcond_liver_updatew2tolast hcond_malig_updatew2tolast hcond_epilep_updatew2tolast hcond_hyperte_updatew2tolast hcond_nonlisted_updatew2tolast { gen byte `var' =. } *w1-w9 replace hcond_angina_updatew2tolast= hcond_angina_newwave2to9 if wave<=9 replace hcond_asthma_updatew2tolast= hcond_asthma_newwave2to9 if wave<=9 replace hcond_arthr_updatew2tolast= hcond_arthr_newwave2to9 if wave<=9 replace hcond_bron_updatew2tolast= hcond_bron_newwave2to9 if wave<=9 replace hcond_chd_updatew2tolast= hcond_chd_newwave2to9 if wave<=9 replace hcond_diab_updatew2tolast= hcond_diab_updatew2tolast if wave<=9 replace hcond_emphys_updatew2tolast= hcond_emphys_newwave2to9 if wave<=9 replace hcond_epilep_updatew2tolast= hcond_epilep_newwave2to9 if wave<=9 replace hcond_hearttmi_updatew2tolast= hcond_hatmi_newwave2to9 if wave<=9 replace hcond_hf_updatew2tolast= hcond_hf_newwave2to9 if wave<=9 replace hcond_hyperte_updatew2tolast= hcond_hyperte_newwave2to9 if wave<=9 replace hcond_hypothy_updatew2tolast= hcond_hypothy_newwave2to9 if wave<=9 replace hcond_liver_updatew2tolast= hcond_liver_newwave2to9 if wave<=9 replace hcond_malig_updatew2tolast= hcond_malig_newwave2to9 if wave<=9 replace hcond_nonlisted_updatew2tolast= hcond_noneoflisted_newwave2to9 if wave<=9 replace hcond_stroke_updatew2tolast= hcond_stroke_newwave2to9 if wave<=9 *w11-w13 changed replace hcond_angina_updatew2tolast= hcond_angina_hcondw10p if wave >=11 replace hcond_arthr_updatew2tolast= hcond_arthr_hcondw10p if wave >=11 replace hcond_asthma_updatew2tolast= hcond_asthma_hcondw10p if wave >=11 replace hcond_bron_updatew2tolast= hcond_bron_hcondw10p if wave >=11 replace hcond_chd_updatew2tolast= hcond_chd_hcondw10p if wave >=11 replace hcond_diab_updatew2tolast= hcond_diab_hcondw10p if wave >=11 replace hcond_emphys_updatew2tolast= hcond_emphys_hcondw10p if wave >=11 replace hcond_epilep_updatew2tolast= hcond_epilep_hcondw10p if wave >=11 replace hcond_hearttmi_updatew2tolast= hcond_hatmi_hcondw10p if wave >=11 replace hcond_hf_updatew2tolast= hcond_hf_hcondw10p if wave >=11 replace hcond_hyperte_updatew2tolast= hcond_hyperte_hcondw10p if wave >=11 replace hcond_hypothy_updatew2tolast= hcond_hypothy_hcondw10p if wave >=11 replace hcond_liver_updatew2tolast= hcond_liver_hcondw10p if wave >=11 replace hcond_malig_updatew2tolast= hcond_malig_hcondw10p if wave >=11 replace hcond_nonlisted_updatew2tolast= hcond_noneoflisted_hcondw10p if wave >=11 replace hcond_stroke_updatew2tolast= hcond_stroke_hcondw10p if wave >=11 *Labeling label variable hcond_angina_updatew2tolast "Disease update w2 to last: Angina" label variable hcond_arthr_updatew2tolast "Disease update w2 to last: Arthritis" label variable hcond_asthma_updatew2tolast "Disease update w2 to last: Asthma" label variable hcond_bron_updatew2tolast "Disease update w2 to last: Chronic bronchitis" label variable hcond_chd_updatew2tolast "Disease update w2 to last: CHD" label variable hcond_diab_updatew2tolast "Disease update w2 to last: Diabetes" label variable hcond_emphys_updatew2tolast "Disease update w2 to last: Emphysema" label variable hcond_epilep_updatew2tolast "Disease update w2 to last: Epilepsy" label variable hcond_hearttmi_updatew2tolast "Disease update w2 to last: Heart or MI" label variable hcond_hf_updatew2tolast "Disease update w2 to last: Congestive heart failure" label variable hcond_hyperte_updatew2tolast "Disease update w2 to last: Hypertension" label variable hcond_hypothy_updatew2tolast "Disease update w2 to last: Hypothyroidism" label variable hcond_liver_updatew2tolast "Disease update w2 to last: Liver condition" label variable hcond_malig_updatew2tolast "Disease update w2 to last: Malignany" label variable hcond_nonlisted_updatew2tolast "Disease update w2 to last: None of the listed" label variable hcond_stroke_updatew2tolast "Disease update w2 to last: Stroke" *************************************** * Age told mvdecode hcond_*_w10plus_age, mv(-8=.b \ -7=.b \ -1=.a) mvdecode hcond_*_age_w1tola, mv(-8=.b) * Recode FI psychological variables with -8 (not applicable to 0) and -10=. mvdecode drugcannabis druggluesolventsniffing drugsother hospitalinpatient_yn hospitalinpatient_days numbercigarettes scl_*, mv(-10=.c) mvdecode alonelinessfeeling dissev_memorydifficulty hospitalinpatient_yn hospitalinpatient_days numbercigarettes, mv(-10=.c) tab2 self_completion_flag_dv wave, mi nolabel tab2 self_completion_flag_dv wave, mi *************************************** * Self-completion and health limitations table wave self_completion_flag_dv scs_generalhealth_sf1_f2f , missing nototals statistic(percent) table wave self_completion_flag_dv scs_generalhealth_scsf1_sc , missing nototals statistic(percent) table wave self_completion_flag_dv sf2a_hl_moderateactivities , missing nototals statistic(percent) table wave self_completion_flag_dv scs_hl_moderateactivities , missing tab1 scs_*, mi mvdecode scs_*, mv(-10=. \ -9=. \ -7=. \ -2=. \ -1=.) * In applicable -8 as missing recode scs_* (-8=.) tab1 scs_*, mi tab scs_generalhealth_sf1_f2f, mi nolabel * Recode SF12 module n=12 (hl= health limitations) no group recoding * Only Wave 1 * in step 1 done Replace values of variables which are only available in one wave: sf1-sf7 are named differently from wave2: scsf1-scsf7 * General health * recode scs_generalhealth_sf1_f2f (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1) if wave==1, gen(scs_generalhealth_sf1_f2fFI) recode scs_generalhealth_sf1_f2f (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(scs_generalhealth_sf1_f2fFI) *Activities recode sf2a_hl_moderateactivities (1=1) (2=0.50) (3=0), gen(sf2a_hl_moderateactivitiesFI) recode sf2b_hl_climbingstairs (1=1) (2=0.50) (3=0), gen(sf2b_hl_climbingstairsFI) * Last 4 weeks recode sf3a_hl_work (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(sf3a_hl_workFI) recode sf3b_hl_kindofwork (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(sf3b_hl_kindofworkFI) recode sf4a_hl_emotionalprob_laccomplis (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(sf4a_hl_emotionalprob_laccomplFI) recode sf4b_hl_emotionalprob_lesscarefu (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(sf4b_hl_emotionalprob_lesscareFI) recode sf5_hl_painwork (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(sf5_hl_painworkFI) recode sf6a_hl_feeling_calm (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(sf6a_hl_feeling_calmFI) recode sf6b_hl_having_enery (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(sf6b_hl_having_eneryFI) recode sf6c_hl_feeling_depressed (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(sf6c_hl_feeling_depressedFI) recode sf7_hl_emotionalprobsocialact (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(sf7_hl_emotionalprobsocialactFI) ********************* * All waves 2++ * General health recode scs_generalhealth_scsf1_sc (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(scs_generalhealth_scsf1_scFI) * Activities recode scs_hl_moderateactivities (1=1) (2=0.50) (3=0), gen(scs_hl_moderateactivitiesFI) recode scs_hl_climbingstairs (1=1) (2=0.50) (3=0), gen(scs_hl_climbingstairsFI) **************************** * Last 4 weeks recode scs_hl_work (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(scs_hl_workFI) recode scs_hl_kindofwork (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(scs_hl_kindofworkFI) recode scs_hl_emotionalprob_laccomplish (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(scs_hl_emotionalprob_laccomplFI) recode scs_hl_emotionalprob_lesscareful (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(scs_hl_emotionalprob_lescarfulFI) recode scs_hl_painwork (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(scs_hl_painworkFI) recode scs_hl_feeling_calm (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(scs_hl_feeling_calmFI) recode scs_hl_having_enery (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1), gen(scs_hl_having_eneryFI) recode scs_hl_feeling_depressed (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(scs_hl_feeling_depressedFI) recode scs_hl_emotionalprobsocialact (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0), gen(scs_hl_emotionalprobsocialactFI) * Control FI candidates after recoding foreach var of varlist scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI { tab2 `var' wave, mi } ******************** * https://www.statalist.org/forums/forum/general-stata-discussion/general/1469564-how-to-label-missing-values label variable scs_generalhealth_scsf1_scFI "General health" label variable scs_hl_moderateactivitiesFI "Health limitations moderate activities" label variable scs_hl_climbingstairsFI "Health limitations climbing several flights of stairs" label variable scs_hl_workFI "Physical health limitations amount of work" label variable scs_hl_kindofworkFI "Physical health limitations kind of work" label variable scs_hl_emotionalprob_laccomplFI "Health limitations mental health meant accomplished less" label variable scs_hl_emotionalprob_lescarfulFI "Health limitations mental health meant worked less carefully" label variable scs_hl_painworkFI "Health limitations pain interfered with work" label variable scs_hl_feeling_calmFI "Health limitations felt calm and peaceful" label variable scs_hl_having_eneryFI "Health limitations having energy" label variable scs_hl_feeling_depressedFI "Health limitations felt downhearted and depressed" label variable scs_hl_emotionalprobsocialactFI "Health limitations physical/mental health interfered with social life" label define missingFI_lab .a "missing refusal\don't know" .b "missing proxy\missing" .c "missing Not available for IEMB" label values disdif_* missingFI_lab label values scs_* missingFI_lab save "$outpath/pidphidplongfile_betweenmissingsrecoding.dta", replace use "$outpath/pidphidplongfile_betweenmissingsrecoding.dta", clear gen scs_generalhealth_comb_scsf1sf1=. replace scs_generalhealth_comb_scsf1sf1=scs_generalhealth_scsf1_scFI if wave>=6 & inrange(scs_generalhealth_scsf1_scFI,0,1) * Some replacements replace scs_generalhealth_comb_scsf1sf1=scs_generalhealth_sf1_f2fFI if (wave>=6 & (scs_generalhealth_scsf1_scFI==.b)) * Frequency scs_generalhealth* if wave 6 or later sum scs_generalhealth_comb_scsf1sf1 scs_generalhealth_scsf1_scFI scs_generalhealth_sf1_f2fFI sum scs_generalhealth_comb_scsf1sf1 scs_generalhealth_scsf1_scFI scs_generalhealth_sf1_f2fFI if wave>=6 tab scs_generalhealth_comb_scsf1sf1 if wave>=6, mi /* Control */ mdesc hcond_*_agetold hcond_*_w10plus_age hcond_*_inw3_agetold mdesc hcond_*_hcond disdif_*FI scs_*FI * New entrants mdesc hcond_*_hcond hcond_*_updatew2tolast sum hcond_*_hcond hcond_*_updatew2tolast * Difference age of intervicond_angina_age_w1tola hcond_arthr_age_w1tola hcond_asthma_age_w1tola hcond_bron_age_w1tola hcond_chd_age_w1tola foreach var of varlist hcond_angina_age_w1tola hcond_arthr_age_w1tola hcond_asthma_age_w1tola hcond_bron_age_w1tola hcond_chd_age_w1tola hcond_diab_age_w1tola hcond_emphys_age_w1tola hcond_epilep_age_w1tola hcond_hatmi_age_w1tola hcond_hf_age_w1tola hcond_hyperte_age_w1tola hcond_hypothy_age_w1tola hcond_liver_age_w1tola hcond_malig_age_w1tola hcond_stroke_age_w1tola { generate byte `var'_diffAI = ageatinterview_dv - `var' label variable `var'_diffAI "ageatinterview_dv - `var' " } sum *_diffAI tab1 *_diffAI, mi table disdif_mobilityFI wave hcond_longstandill_hcond , missing nototals statistic(percent) *bysort wave: mdesc hcond_*_updatew2tolast * Wave 1 sum hcond_*_hcond if wave==1 * Wave 2 mdesc hcond_*_hcond if wave==2 * Wave 10 sum hcond_*_everinw10 if wave==10 * Descriptive statistics: General health all waves and wave 6 and later sum scs_generalhealth_scsf1_sc scs_generalhealth_sf1_f2f scs_generalhealth_sf1_f2fFI scs_generalhealth_scsf1_scFI scs_generalhealth_comb_scsf1sf1 bysort wave: sum scs_generalhealth_sf1_f2fFI scs_generalhealth_scsf1_scFI graph dot (mean) scs_generalhealth_sf1_f2fFI scs_generalhealth_scsf1_scFI if wave<=9, over(wave) title("", span) note("https://www.understandingsociety.ac.uk/documentation/mainstage/dataset-documentation/variable/sf1 + scsf1 and variable note", span) ** Graph health limitation sf* wave 1 vs vs wave 2 sum scs_hl_moderateactivitiesFI scs_hl_climbingstairsFI scs_hl_workFI scs_hl_kindofworkFI scs_hl_emotionalprob_laccomplFI scs_hl_emotionalprob_lescarfulFI scs_hl_painworkFI scs_hl_feeling_calmFI scs_hl_having_eneryFI scs_hl_feeling_depressedFI scs_hl_emotionalprobsocialactFI if wave<=2 bysort wave: sum scs_hl_moderateactivitiesFI scs_hl_climbingstairsFI scs_hl_workFI scs_hl_kindofworkFI scs_hl_emotionalprob_laccomplFI scs_hl_emotionalprob_lescarfulFI scs_hl_painworkFI scs_hl_feeling_calmFI scs_hl_having_eneryFI scs_hl_feeling_depressedFI scs_hl_emotionalprobsocialactFI if wave<=2 graph dot (mean) scs_generalhealth_sf1_f2fFI scs_hl_climbingstairsFI scs_hl_workFI scs_hl_kindofworkFI scs_hl_emotionalprob_laccomplFI scs_hl_emotionalprob_lescarfulFI scs_hl_painworkFI scs_hl_feeling_calmFI scs_hl_having_eneryFI scs_hl_feeling_depressedFI scs_hl_emotionalprobsocialactFI if wave<=2, over(wave) title("Scores of health limitations unbalanced panel in the first two waves", span) note("https://www.understandingsociety.ac.uk/documentation/mainstage/dataset-documentation/variable/sf1") preserve use "$outpath/pidphidplongfile_betweenmissingsrecoding.dta" if wave<=2, clear tab wave bysort wave: sum scs_generalhealth_scsf1_sc scs_hl_* # delimit ; table1_mc, by (wave) vars (scs_generalhealth_scsf1_sc contn %5.2f \ scs_hl_moderateactivities contn %5.2f \ scs_hl_climbingstairs contn %5.2f \ scs_hl_work contn %5.2f \ scs_hl_kindofwork contn %5.2f \ scs_hl_emotionalprob_laccomplish contn %5.2f \ scs_hl_emotionalprob_lesscareful contn %5.2f \ scs_hl_painwork contn %5.2f \ scs_hl_feeling_calm contn %5.2f \ scs_hl_having_enery contn %5.2f \ scs_hl_feeling_depressed contn %5.2f\ scs_hl_emotionalprobsocialact contn %5.2f) percent onecol missing nospace clear ; # delimit cr drop N_* m_* pvalue table1_mc_dta2docx using "$tables\unbalanced panel\FI_items_score_domhealthlimit_sfvars_in_wave1and2.docx", replace landscape font("Calibri", 7) datafont("Calibri", 7) tablenumber("Table XX") tabletitle("Scores of health limitations unbalanced panel in the first two waves: face-to-face in wave 1 vs self-completion in wave 2") footnote("") ***** restore * Subcategorisation of arthritis, diabetes, malignancy label variable hcond_arthr_w10plus_age "Starting age rheumatoid arthritis summarised in w10 and plus" label variable hcond_arthrosteo_w10plus_age "Starting age osteoarthritis in w10 and plus" label variable hcond_arthrheum_w10plus_age "Starting age rheumatoid in w10 and plus" label variable hcond_diab_hcondw10p "Diabetes summarised in wave 10 and plus" label variable hcond_diab_w10plus_age "Diabetes age summarised in w10 and plus" label variable hcond_diabettyp1_w10plus_age "Starting age type 1 diabetes in w10 and plus" label variable hcond_diabettyp2_w10plus_age "Starting age type 2 diabetes in w10 and plus" label variable hcond_diabettypge_w10plus_age "Starting age gestational diabetes in w10 and plus" label variable hcond_hyperte_hcondOC "hcond hypertension original coding" label variable hcond_malig_hcondw10p "Malignancy summarised in w10 and plus" label variable hcond_malig_w10plus_age "Malignancy age summarised in w10 and plus" label variable hcond_maligbreast_w10plus_age "Starting age breast cancer in w10 and plus" label variable hcond_maligliver_w10plus_age "Starting age liver cancer in w10 and plus" label variable hcond_maliglung_w10plus_age "Starting age lung cancer in w10 and plus" label variable hcond_maligprost_w10plus_age "Starting age prostate cancer in w10 and plus" label variable hcond_maligskin_w10plus_age "Starting age skin cancer in w10 and plus" label variable hcond_arthr_age_w1tola "Starting age arthritis cancer in w1-w12" label variable hcond_diab_age_w1tola "Starting age diabetes cancer in w1-w12" label variable hcond_malig_age_w1tola "Starting age malignancy cancer in w1-w12" sum wave tab wave compress save "$outpath/pidphidplongfile_forstart_hcond.dta", replace ********************************************************************************************************************************** * Step 10: Hcond updating calculation /* Creating from wave-specific hcond_*_age_w1tola-> collapsed hcond_*_age_w1tola_min + hcond_*_age_w1tola_minw10-*/ use "$outpath/pidphidplongfile_forstart_hcond.dta", clear tab wave sum hcond_bron_hcond hcond_bron_still hcond_bron_age_w1tola hcond_bron_newwave2to9 hcond_bron_hcondw10p hcond_bron_newwave10p hcond_bron_everinw10 hcond_bron_newwave11p hcond_bron_age_w1tola_minw10 hcond_bron_hcondOC hcond_bron_updatew2tolast * Describing hypertension and age tab2 hcond_hyperte_age_w1tola hcond_hyperte_hcond, mi tab2 hcond_hyperte_age_w1tola hcond_hyperte_newwave2to9, mi collapse (min) hcond_angina_age_w1tola hcond_arthr_age_w1tola hcond_asthma_age_w1tola hcond_bron_age_w1tola hcond_chd_age_w1tola hcond_copd_age_w10tola hcond_diab_age_w1tola hcond_emphys_age_w1tola hcond_epilep_age_w1tola hcond_hatmi_age_w1tola hcond_hf_age_w1tola hcond_hyperte_age_w1tola hcond_hyperthy_age_w1tola hcond_hypothy_age_w1tola hcond_liver_age_w1tola hcond_malig_age_w1tola hcond_ms_age_w1tola hcond_stroke_age_w1tola hcond_angina_age_w1tola_minw10 hcond_arthr_age_w1tola_minw10 hcond_asthma_age_w1tola_minw10 hcond_bron_age_w1tola_minw10 hcond_chd_age_w1tola_minw10 hcond_copd_age_w10tola_minw10 hcond_diab_age_w1tola_minw10 /*hcond_emnervpsyprob_everinw10*/ hcond_emphys_age_w1tola_minw10 hcond_epilep_age_w1tola_minw10 hcond_hatmi_age_w1tola_minw10 hcond_hiv_age_w1tola_minw10 hcond_hf_age_w1tola_minw10 hcond_hyperte_age_w1tola_minw10 /*hcond_hyperthy_age_w1tola_minw10*/ hcond_hypothy_age_w1tola_minw10 hcond_liver_age_w1tola_minw10 hcond_malig_age_w1tola_minw10 hcond_ms_age_w1tola_minw10 hcond_stroke_age_w1tola_minw10, by(pidp) * Renaming for min value rename hcond_angina_age_w1tola hcond_angina_age_w1tola_min rename hcond_arthr_age_w1tola hcond_arthr_age_w1tola_min rename hcond_asthma_age_w1tola hcond_asthma_age_w1tola_min rename hcond_bron_age_w1tola hcond_bron_age_w1tola_min rename hcond_chd_age_w1tola hcond_chd_age_w1tola_min rename hcond_copd_age_w10tola hcond_copd_age_w1tola_min rename hcond_hf_age_w1tola hcond_hf_age_w1tola_min rename hcond_diab_age_w1tola hcond_diab_age_w1tola_min rename hcond_emphys_age_w1tola hcond_emphys_age_w1tola_min rename hcond_epilep_age_w1tola hcond_epilep_age_w1tola_min rename hcond_hatmi_age_w1tola hcond_hatmi_age_w1tola_min rename hcond_hyperte_age_w1tola hcond_hyperte_age_w1tola_min rename hcond_hyperthy_age_w1tola hcond_hyperthy_age_w1tola_min rename hcond_hypothy_age_w1tola hcond_hypothy_age_w1tola_min rename hcond_liver_age_w1tola hcond_liver_age_w1tola_min rename hcond_malig_age_w1tola hcond_malig_age_w1tola_min rename hcond_ms_age_w1tola hcond_ms_age_w1tola_min rename hcond_stroke_age_w1tola hcond_stroke_age_w1tola_min mdesc sum tab1 hcond_angina_age_w1tola_min-hcond_stroke_age_w1tola_min, mi compress save "$outpath\hcond_hcond_w1tola_min_collapsed.dta", replace ******************************************************************************** use "$outpath/pidphidplongfile_forstart_hcond.dta", clear keep if interview_waveentry_iser==2 compress tab1 wave interview_waveentry_iser collapse (min) hcond_angina_age_w1tola hcond_arthr_age_w1tola hcond_asthma_age_w1tola hcond_bron_age_w1tola hcond_chd_age_w1tola hcond_copd_age_w10tola hcond_diab_age_w1tola hcond_emphys_age_w1tola hcond_epilep_age_w1tola hcond_hatmi_age_w1tola hcond_hf_age_w1tola hcond_hyperte_age_w1tola hcond_hyperthy_age_w1tola hcond_hypothy_age_w1tola hcond_liver_age_w1tola hcond_malig_age_w1tola hcond_ms_age_w1tola hcond_stroke_age_w1tola hcond_angina_age_w1tola_minw10 hcond_arthr_age_w1tola_minw10 hcond_asthma_age_w1tola_minw10 hcond_bron_age_w1tola_minw10 hcond_chd_age_w1tola_minw10 hcond_copd_age_w10tola_minw10 hcond_diab_age_w1tola_minw10 /*hcond_emnervpsyprob_everinw10*/ hcond_emphys_age_w1tola_minw10 hcond_epilep_age_w1tola_minw10 hcond_hatmi_age_w1tola_minw10 hcond_hiv_age_w1tola_minw10 hcond_hf_age_w1tola_minw10 hcond_hyperte_age_w1tola_minw10 /*hcond_hyperthy_age_w1tola_minw10*/ hcond_hypothy_age_w1tola_minw10 hcond_liver_age_w1tola_minw10 hcond_malig_age_w1tola_minw10 hcond_ms_age_w1tola_minw10 hcond_stroke_age_w1tola_minw10, by(pidp) * Renaming for min value rename hcond_angina_age_w1tola hcond_angina_age_w1tola_min rename hcond_arthr_age_w1tola hcond_arthr_age_w1tola_min rename hcond_asthma_age_w1tola hcond_asthma_age_w1tola_min rename hcond_bron_age_w1tola hcond_bron_age_w1tola_min rename hcond_chd_age_w1tola hcond_chd_age_w1tola_min rename hcond_copd_age_w10tola hcond_copd_age_w1tola_min rename hcond_hf_age_w1tola hcond_hf_age_w1tola_min rename hcond_diab_age_w1tola hcond_diab_age_w1tola_min rename hcond_emphys_age_w1tola hcond_emphys_age_w1tola_min rename hcond_epilep_age_w1tola hcond_epilep_age_w1tola_min rename hcond_hatmi_age_w1tola hcond_hatmi_age_w1tola_min rename hcond_hyperte_age_w1tola hcond_hyperte_age_w1tola_min rename hcond_hyperthy_age_w1tola hcond_hyperthy_age_w1tola_min rename hcond_hypothy_age_w1tola hcond_hypothy_age_w1tola_min rename hcond_liver_age_w1tola hcond_liver_age_w1tola_min rename hcond_malig_age_w1tola hcond_malig_age_w1tola_min rename hcond_ms_age_w1tola hcond_ms_age_w1tola_min rename hcond_stroke_age_w1tola hcond_stroke_age_w1tola_min ********************** ********************** * Merging back the collapsed information use "$outpath/pidphidplongfile_forstart_hcond.dta", clear merge m:1 pidp using "$outpath/hcond_hcond_w1tola_min_collapsed.dta" tab _merge drop _merge * Creating cum variables: hcond_*_age_w1tola_min values if before age of interview =1 or after interview/missing foreach var of newlist hcond_angina_age_w1tola_min_cum hcond_arthr_age_w1tola_min_cum hcond_asthma_age_w1tola_min_cum hcond_bron_age_w1tola_min_cum hcond_chd_age_w1tola_min_cum hcond_diab_age_w1tola_min_cum hcond_emphys_age_w1tola_min_cum hcond_epilep_age_w1tola_min_cum hcond_hatmi_age_w1tola_min_cum hcond_hf_age_w1tola_min_cum hcond_hyperte_age_w1tola_min_cum hcond_hypothy_age_w1tola_min_cum hcond_liver_age_w1tola_min_cum hcond_malig_age_w1tola_min_cum hcond_stroke_age_w1tola_min_cum { gen byte `var' =. label variable `var' "`var' of hcond_*_age_w1tola_min and ageatinterview_dv" } * Replace hcond_*_age_w1tola_min_cum values if necessary foreach var of varlist hcond_angina_age_w1tola_min hcond_arthr_age_w1tola_min hcond_asthma_age_w1tola_min hcond_bron_age_w1tola_min hcond_chd_age_w1tola_min hcond_diab_age_w1tola_min hcond_emphys_age_w1tola_min hcond_epilep_age_w1tola_min hcond_hatmi_age_w1tola_min hcond_hf_age_w1tola_min hcond_hypothy_age_w1tola_min hcond_hyperte_age_w1tola_min hcond_liver_age_w1tola_min hcond_malig_age_w1tola_min hcond_stroke_age_w1tola_min /* hcond_epilep_age_w1tola_min */ { replace `var'_cum=1 if `var' <= ageatinterview_dv replace `var'_cum=0 if (`var' > ageatinterview_dv | `var'==.) } sum hcond_*_age_w1tola_min_cum ******************************************************************************** *Creating hcond_hyperte_age_min * Generalisation case foreach var of varlist hcond_angina_age_w1tola_min hcond_arthr_age_w1tola_min hcond_asthma_age_w1tola_min hcond_bron_age_w1tola_min hcond_chd_age_w1tola_min hcond_diab_age_w1tola_min hcond_emphys_age_w1tola_min hcond_epilep_age_w1tola_min hcond_hatmi_age_w1tola_min hcond_hf_age_w1tola_min hcond_hypothy_age_w1tola_min hcond_hyperte_age_w1tola_min hcond_liver_age_w1tola_min hcond_malig_age_w1tola_min hcond_stroke_age_w1tola_min { egen byte `var'MIN= rowmin(`var' `var'w10) replace `var'MIN= `var' if (`var' > `var'w10) replace `var'MIN= `var'w10 if `var'==. label variable `var'MIN "`var'MIN of specific wave and ever in w10" } sum *_minMIN *tab1 hcond_*_age_w1tola_minMIN, mi * Histogram age differences: specific wave vs wave 10 gen byte hcond_hyperte_age1tola_w10na_dif= hcond_hyperte_age_w1tola_min - hcond_hyperte_age_w1tola_minw10 hist hcond_hyperte_age1tola_w10na_dif, percent subtitle("hcond_hyperte_age_w1tola_min - hcond_hyperte_age_w1tola_minw10") ******************************************************************************** * Declare panel dataset for identifying first and last observations bysort pidp (wave): gen byte obsnumperpidp = _n bysort pidp (wave): gen byte totnumperpidp = _N * Defining as panel dataset xtset pidp obsnumperpidp *Creating indicator for the first appearance, last appearance other number of appearances gen byte interview_pidp_waveentry1st_Dny = 0 bysort pidp (wave): replace interview_pidp_waveentry1st_Dny = 1 if _n == 1 *Creating indicator for the last.appearance *bysort group (counter) : gen num_max = counter[_N] gen byte interview_pidp_waveentryLst_Dny = 0 by pidp: replace interview_pidp_waveentryLst_Dny = 1 if _n == _N * Panel observation gaps identifying gen byte pidp_wavegaps_notfullbalanced = obsnumperpidp - wave if interview_pidp_waveentryLst_Dny == 1 * Checking if first appearance is in wave 1 by pidp, sort: egen byte interview_waveentry_w1_dval = max(cond(wave == interview_pidp_waveentry1st_Dny, 1, 0)) * Checking if first appearance is in wave 2 or any other later apperance foreach var of newlist interview_waveentry_w2_dval interview_waveentry_w3_dval interview_waveentry_w4_dval interview_waveentry_w5_dval interview_waveentry_w6_dval interview_waveentry_w7_dval interview_waveentry_w8_dval interview_waveentry_w9_dval interview_waveentry_w10_dval interview_waveentry_w11_dval interview_waveentry_w12_dval { gen byte `var' =0 label variable `var' "`var' " } by pidp: replace interview_waveentry_w2_dval=1 if (wave==2 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w3_dval=1 if (wave==3 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w4_dval=1 if (wave==4 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w5_dval=1 if (wave==5 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w6_dval=1 if (wave==6 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w7_dval=1 if (wave==7 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w8_dval=1 if (wave==8 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w9_dval=1 if (wave==9 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w10_dval=1 if (wave==10 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w11_dval=1 if (wave==11 & interview_pidp_waveentry1st_Dny==1) by pidp: replace interview_waveentry_w12_dval=1 if (wave==12 & interview_pidp_waveentry1st_Dny==1) * First appearance in panel: hcond* distributions foreach var of varlist hcond_angina_hcondOC hcond_arthr_hcondOC hcond_asthma_hcondOC hcond_bron_hcondOC hcond_chd_hcondOC hcond_copd_hcondOC hcond_diab_hcondOC hcond_emphys_hcondOC hcond_epilep_hcondOC hcond_hatmi_hcondOC hcond_hf_hcondOC hcond_hyperte_hcondOC hcond_hypothy_hcondOC hcond_liver_hcondOC hcond_malig_hcondOC hcond_stroke_hcondOC { tab2 interview_pidp_waveentry1st_Dny `var' , mi } * ISER Team #1972: cannot be interview_pidp_waveentry1st_Dny==0 & hcond_hyperte_hcondOC==1) label variable hcond_hyperte_age1tola_w10na_dif "hcond_hyperte_age_w1tola_min - hcond_hyperte_age_na" label variable interview_pidp_waveentry1st_Dny "First (panel entry) interview pidp dummy" label variable interview_pidp_waveentryLst_Dny "Last (panel exit) interview pidp dummy" label variable obsnumperpidp "Particular number of observation per pidp" label variable totnumperpidp "Total number of observations per pidp" compress save "$outpath/hcond_cumulated_waveentry1stDny_before BHPS_merging.dta", replace ******************************* * Every respodent has to have an entry recoded hcond condition use "$outpath/hcond_cumulated_waveentry1stDny_before BHPS_merging.dta", clear keep pidp wave hcond_*_hcondOC interview_pidp_waveentry1st_Dny interview_waveentry_iser interview_pidp_waveentryLst_Dny tab1 interview_pidp_waveentry1st_Dny interview_pidp_waveentryLst_Dny * Selection if new entrants enter in wave 1 or later waves keep if interview_pidp_waveentry1st_Dny==1 * Recoding health conditions orginal coding variables (hcond_*_hcondOC) foreach var of varlist hcond_angina_hcondOC hcond_arthr_hcondOC hcond_asthma_hcondOC hcond_bron_hcondOC hcond_chd_hcondOC hcond_copd_hcondOC hcond_diab_hcondOC hcond_emphys_hcondOC hcond_epilep_hcondOC hcond_hatmi_hcondOC hcond_hf_hcondOC hcond_hyperte_hcondOC hcond_hyperthy_hcondOC hcond_hypothy_hcondOC hcond_liver_hcondOC hcond_malig_hcondOC hcond_ms_hcondOC hcond_stroke_hcondOC { recode `var' (-9/-1=.), gen(`var'EI) } * Crosstabulation first entry with the health conditions variable: hcond_`var'_hcondOC and `var'EI foreach var of varlist hcond_angina_hcondOC hcond_arthr_hcondOC hcond_asthma_hcondOC hcond_bron_hcondOC hcond_chd_hcondOC hcond_copd_hcondOC hcond_diab_hcondOC hcond_emphys_hcondOC hcond_epilep_hcondOC hcond_hatmi_hcondOC hcond_hf_hcondOC hcond_hyperte_hcondOC hcond_hyperthy_hcondOC hcond_hypothy_hcondOC hcond_liver_hcondOC hcond_malig_hcondOC hcond_ms_hcondOC hcond_stroke_hcondOC { tab2 interview_pidp_waveentry1st_Dny `var' , mi *****asdoc tab `var'EI, append label mi nocf save($tables\100_hcond_entryindicat.doc) distinct pidp } drop hcond_hyperte_hcondOC label variable hcond_hyperte_hcondOCEI "Hcond Hypertension 1st appearance indicator" save "$outpath/hcond_cumulated_waveentry1stDny_hcondentryIndicator.dta", replace * Merging back the waveentry1stDny hcondentryIndicator information to the panel data set use "$outpath/hcond_cumulated_waveentry1stDny_before BHPS_merging.dta", clear merge m:1 pidp using "$outpath/hcond_cumulated_waveentry1stDny_hcondentryIndicator.dta" tab _merge drop _merge compress save "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis.dta", replace ********************************************************************************************************************************** ********************************************************************************************************************************** * Restriction to unbalanced panel and balanced panel (wave centering) * Restriction to unbalanced panel up to wave 9 use "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis.dta", clear describe **SAMPLES 1-8 * https://iserredex.essex.ac.uk/support/issues/1210 *** * SAMPLES 1 and 2 (UKHLS) and sample 7 (emboost) keep if inrange(sample_origin_individual,1,8) & wave<=9 sum wave tab wave gen byte wave_centered=wave-5 gen byte wave_centeredsq=(wave-5)^2 sum wave_centered wave_centeredsq ********************************************** * Initialisation different hcond *cum variables for prevalence with impossible value -99 which will be replaced later foreach var of newlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { gen byte `var' =-99 } * Replacement different hcond variables for prevalence with hcond_`var'_hcondOCEI (first apperance and hcondentryindicator) foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { replace `var'=1 if interview_pidp_waveentry1st_Dny==1 & hcond_`var'_hcondOCEI==1 replace `var'=0 if interview_pidp_waveentry1st_Dny==1 & hcond_`var'_hcondOCEI==0 replace `var'=. if interview_pidp_waveentry1st_Dny==1 & hcond_`var'_hcondOCEI==. } * Control of frequencies foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { tab2 `var' hcond_`var'_hcondOC if interview_pidp_waveentry1st_Dny==1, mi } compress /*variable time_square was int now byte*/ label variable angina "Angina" label variable arthr "Arthritis" label variable asthma "Asthma" label variable bron "Bronchitis" label variable copd "Copd" label variable diab "Diabetes" label variable emphys "Emphysema" label variable hatmi "Heart attack/MI" label variable hf "Congestive heart failure" label variable hyperte "Hypertension" label variable hyperthy "Hyperthyroidism" label variable hypothy "Hypothyroidism" label variable liver "Liver condition" label variable malig "Malignancy/cancer" label variable ms "Multiple sclerosis" label variable stroke "Stroke" label variable wave_centered "wave centered" label variable wave_centeredsq "wave centered square" save "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis_initialcondition.dta", replace ********************************************** * Case 1: hcond_hyperte_hcondOCEI==1 (hypertension as example for a health condition, extend to other health conditions) use "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis_initialcondition.dta", clear * Frequencies and list as start for hcond_hyperte_hcondOCEI==1 tab hyperte if interview_pidp_waveentry1st_Dny==0 & hcond_hyperte_hcondOCEI==1, mi * Missings and frequency distribution * Some missings for age but no consequence * Replacement of hyperte=1 if hcond existence at entry foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { replace `var'=1 if hcond_`var'_hcondOCEI==1 } * Control of frequencies for hcond_hyperte_hcondOCEI==1 foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { tab hcond_`var'_hcondOCEI `var' if hcond_`var'_hcondOCEI==1, mi } ********************************************** * Case 2: hcond_hyperte_hcondOCEI==0 * Frequencies and list as start for hcond_hyperte_hcondOCEI==0 tab hyperte if interview_pidp_waveentry1st_Dny==0 & hcond_hyperte_hcondOCEI==0, mi * updating hcond`var' in waves 2 to 9 gen byte hcond_copd_newwave2to9=. * with information hcond_`var'_newwave2to9==0 foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { replace `var'=0 if interview_pidp_waveentry1st_Dny==0 & hcond_`var'_hcondOCEI==0 & hcond_`var'_newwave2to9==0 } * with information missings hcond_`var'_newwave2to9==.a or b. foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { replace `var'=. if interview_pidp_waveentry1st_Dny==0 & hcond_`var'_hcondOCEI==0 & (hcond_`var'_newwave2to9==.a | hcond_`var'_newwave2to9==.b ) } ** with information hcond_`var'_newwave2to9==1: develops hcond e.g. hypertension and updating necessary foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { replace `var'=1 if interview_pidp_waveentry1st_Dny==0 & hcond_`var'_hcondOCEI==0 & hcond_`var'_newwave2to9==1 } *(Re-)calculate hcond_hyperte_age_w1tola_min=ageatinterview_dv if hcond_hyperte_newwave2to9==1 (hypertension after updating) * but before changing minimum age for a respondent accross waves foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { replace hcond_`var'_age_w1tola_min=ageatinterview_dv if interview_pidp_waveentry1st_Dny==0 & hcond_`var'_hcondOCEI==0 & hcond_`var'_newwave2to9==1 } * Control of replacement list sample_origin_individual pidp wave interview_pidp_waveentry1st_Dny ageatinterview_dv hcond_hyperte_age_w1tola_min hcond_hyperte_age_w1tola_minw10 hcond_hyperte_age_w1tola_minMIN hcond_hyperte_hcondOCEI hcond_hyperte_hcondOC hcond_hyperte_newwave2to9 hcond_hyperte_everinw10 hcond_hyperte_newwave11p hyperte in 1/100 if ( inrange(sample_origin_individual,1,8) & wave<=9 & hcond_hyperte_hcondOCEI==0), compress tab hyperte if ( inrange(sample_origin_individual,1,8) & wave<=9 & hcond_hyperte_hcondOCEI==0), mi * Mininim age hcond_hyperte_age_w1tola_min: several occurccenes for a pidp possible preserve collapse (min) hcond_angina_age_w1tola_min hcond_arthr_age_w1tola_min hcond_asthma_age_w1tola_min hcond_bron_age_w1tola_min hcond_chd_age_w1tola_min hcond_copd_age_w1tola_min hcond_diab_age_w1tola_min hcond_emphys_age_w1tola_min hcond_epilep_age_w1tola_min hcond_hatmi_age_w1tola_min hcond_hf_age_w1tola_min hcond_hyperte_age_w1tola_min hcond_hypothy_age_w1tola_min hcond_liver_age_w1tola_min hcond_malig_age_w1tola_min hcond_ms_age_w1tola_min hcond_stroke_age_w1tola_min , by(pidp) save "$outpath/hcond_cumulated_waveentry1stDnyEQ0updatingcumEQ1minage_collapsed.dta", replace restore * Merge the panel dataset with the above collapsed dataset merge m:1 pidp using "$outpath/hcond_cumulated_waveentry1stDnyEQ0updatingcumEQ1minage_collapsed.dta", replace update tab _merge replace hcond_hyperte_age_w1tola_minMIN=hcond_hyperte_age_w1tola_min if hcond_hyperte_hcondOCEI==0 & hcond_hyperte_age_w1tola_min!=. & hcond_hyperte_age_w1tola_minw10!=. replace hyperte=1 if hcond_hyperte_hcondOCEI==0 & hcond_hyperte_age_w1tola_minMIN!=. & hcond_hyperte_age_w1tola_min!=. &ageatinterview_dv>=hcond_hyperte_age_w1tola_minMIN replace hcond_hyperte_age_w1tola_minMIN=hcond_hyperte_age_w1tola_min if hcond_hyperte_hcondOCEI==0 & hcond_hyperte_age_w1tola_min!=. & hcond_hyperte_age_w1tola_minw10==. replace hyperte=1 if hcond_hyperte_hcondOCEI==0 & hcond_hyperte_age_w1tola_min!=. & hcond_hyperte_age_w1tola_minw10==. & ageatinterview_dv>=hcond_hyperte_age_w1tola_minMIN replace hyperte=1 if hcond_hyperte_hcondOCEI==0 & hcond_hyperte_age_w1tola_min==. & hcond_hyperte_age_w1tola_minw10!=. & ageatinterview_dv>=hcond_hyperte_age_w1tola_minMIN * Control of frequencies for hcond_hyperte_hcondOCEI==0 tab hyperte if interview_pidp_waveentry1st_Dny==0 & hcond_hyperte_hcondOCEI==0, mi tab hcond_hyperte_hcondOCEI hyperte if hcond_hyperte_hcondOCEI==0, mi ********************************************** * Case 3: hcond_hyperte_hcondOCEI==. foreach var of varlist angina arthr asthma bron copd diab emphys epilep hatmi hf hyperte hyperthy hypothy liver malig ms stroke { replace `var'=. if interview_pidp_waveentry1st_Dny==0 & hcond_`var'_hcondOCEI==. & inrange(wave,2,9) & ( hcond_`var'_newwave2to9==.a | hcond_`var'_newwave2to9==.b | hcond_`var'_newwave2to9==0 | hcond_`var'_newwave2to9==1) } * Control of replacement list sample_origin_individual pidp wave interview_pidp_waveentry1st_Dny ageatinterview_dv hcond_hyperte_age_w1tola_min hcond_hyperte_age_w1tola_minw10 hcond_hyperte_age_w1tola_minMIN hcond_hyperte_hcondOCEI hcond_hyperte_hcondOC hcond_hyperte_newwave2to9 hcond_hyperte_everinw10 hcond_hyperte_newwave11p hyperte in 1/100 if ( inrange(sample_origin_individual,1,8) & wave<=9 & hcond_hyperte_hcondOCEI==.), compress * Control of frequencies for hcond_hyperte_hcondOCEI==. tab hyperte if interview_pidp_waveentry1st_Dny==0 & hcond_hyperte_hcondOCEI==., mi tab hcond_hyperte_hcondOCEI hyperte if hcond_hyperte_hcondOCEI==., mi * Control of frequencies health conditions * Control FI candidates after recoding foreach var of varlist angina-stroke { tab2 `var' wave, mi } drop _merge compress save "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis_AFTER RECODING ESTIMATION.dta", replace * Collapsing for getting the minimum age of every respondent for hcond_`var'_age_w1tola_minMIN * COPD only from wave 10, MS from wave 7 collapse (min) hcond_angina_age_w1tola_minMIN hcond_arthr_age_w1tola_minMIN hcond_asthma_age_w1tola_minMIN hcond_bron_age_w1tola_minMIN hcond_chd_age_w1tola_minMIN /*hcond_copd_age_w1tola_minMIN*/ hcond_diab_age_w1tola_minMIN hcond_emphys_age_w1tola_minMIN hcond_epilep_age_w1tola_minMIN hcond_hatmi_age_w1tola_minMIN hcond_hf_age_w1tola_minMIN hcond_hyperte_age_w1tola_minMIN hcond_hyperthy_age_w1tola_min hcond_hypothy_age_w1tola_minMIN hcond_liver_age_w1tola_minMIN hcond_malig_age_w1tola_minMIN /*hcond_ms_age_w1tola_minMIN*/ hcond_stroke_age_w1tola_minMIN , by(pidp) * Summary statistics for hcond_`var'_age_w1tola_minMIN mdesc hcond_angina_age_w1tola_minMIN hcond_arthr_age_w1tola_minMIN hcond_asthma_age_w1tola_minMIN hcond_bron_age_w1tola_minMIN hcond_chd_age_w1tola_minMIN hcond_diab_age_w1tola_minMIN hcond_emphys_age_w1tola_minMIN hcond_epilep_age_w1tola_minMIN hcond_hatmi_age_w1tola_minMIN hcond_hf_age_w1tola_minMIN hcond_hyperte_age_w1tola_minMIN hcond_hyperthy_age_w1tola_min hcond_hypothy_age_w1tola_minMIN hcond_liver_age_w1tola_minMIN hcond_malig_age_w1tola_minMIN hcond_stroke_age_w1tola_minMIN * Combined onset of health condition: age * Summary statistics for hcond_*_age_w1tola_minMIN ************************************************************************************************************************************ ************************************************************************************************************************************ * Step 11:Calculation of the Frailty index FI and possible alternatives and sample selection (line 3844) * Calculation of the Frailty index FI use "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis_AFTER RECODING ESTIMATION.dta", clear sort pidp wave tab1 wave sample_origin_individual ageatinterview_dv ageentrypanel_50plus5years ageentrypanel_3cat ageentrypanel_16plus5years ethn_dv, mi * Control for entry into panel and wave tab racel_dv wave, mi tab wave if interview_pidp_waveentry1st_Dny==1 tab interview_waveentry_iser if (sample_origin_individual==7) * Control project 65 tab bron, mi tab bron if wave==3, mi * Not using epilep hypothy keep pidp hidp psu strata us_nhs_hes healthdatalinkagew8 wave wave_centered wave_centeredsq interview_pidp_waveentry1st_Dny interview_pidp_waveentryLst_Dny interview_modus interview_modustype interview_asproxy interview_help_sought_other self_completion_flag_dv self_completion_completed_dv self_completion_accepted gpsemb_csinterviewweight gpsemb_lsinterviewweight self_completion_intervweightscub self_completion_intervweightscui self_completion_intervweightscus fed_forward_interv_outcome_iser fed_forward_ever_interv_iser interview_waveentry_iser sample_origin_household sample_origin_individual hhethnicminoritysample_dv individinterview_proxy_catnew interviewstartdate_year interviewdate_year_individual interviewdate_month_individual countryofresidence sex_dv_catnew ethn_dv ethn_dv_catnew ethn_dv_source racel_dv newbornuk_dv migration_generation birthy ageentrypanel_50plus5years ageentrypan_50plus5catce65to69 ageentrypan_50plus5catce65to69sq ageentrypanel_3cat ageentrypanel_16plus5years ageentrypan_16plus5catce45to49 ageentrypan_16plus5catce45to49sq ageentrypanel_50plus9years ageentrypan_50plus9catce68to76 ageentrypan_50plus9catce68to76sq ageatinterview_dv ageatinterview_dv_sq agein2010 agegr10_dv ageatinterview_dv_categories50 ageatinterview_dv_categories16 dead ageatdeath deathinwaverecorded_new wave_last_enumerated wave_last_interviewed deathyear education_highest education_highest_catnew mastat_dv mastat_dv_catnew cohab_dv bmi_dv numbercigarettes economicactivivity_current jobcurrent_nssec_classification jobcurrent_nssec_classification3 urbanruralresidence hospitalinpatient_yn hospitalinpatient_days hhincomenet_dv disdif_mobilityFI disdif_movingobjectsFI disdif_manualdexterityFI disdif_continenceFI disdif_hearingFI disdif_sightFI disdif_communicationFI disdif_concentratingabbilityFI disdif_recognisingdangerFI disdif_physicalcoordinationFI disdif_difficultiescareFI disdif_otherhealthproblemsFI angina arthr asthma bron /*chd*/ diab emphys /*epilep*/ hatmi hf hyperte /*hypothy*/ liver malig stroke scs_generalhealth_scsf1_scFI scs_generalhealth_sf1_f2fFI scs_hl_painworkFI scs_hl_feeling_calmFI scs_hl_having_eneryFI scs_hl_moderateactivitiesFI scs_hl_climbingstairsFI scs_hl_workFI scs_hl_kindofworkFI scs_hl_emotionalprob_laccomplFI scs_hl_emotionalprob_lescarfulFI scs_hl_feeling_depressedFI scs_hl_emotionalprobsocialactFI missing_covariate * Control age variables tab1 wave wave_centered ageentrypanel_50plus5years ageentrypan_50plus5catce65to69 ageentrypanel_3cat ageentrypanel_16plus5years ageentrypan_16plus5catce45to49, mi gen byte asthma_emphys_comb=-99 replace asthma_emphys_comb=1 if (asthma==1 | emphys==1) replace asthma_emphys_comb=0 if (asthma==0 & emphys==0) replace asthma_emphys_comb=. if (asthma==. | emphys==.) tab asthma_emphys_comb, mi # delimit; order pidp hidp psu strata us_nhs_hes healthdatalinkagew8 wave interview_pidp_waveentry1st_Dny interview_pidp_waveentryLst_Dny interview_modus interview_modustype interview_asproxy interview_help_sought_other self_completion_flag_dv self_completion_completed_dv self_completion_accepted gpsemb_csinterviewweight gpsemb_lsinterviewweight self_completion_intervweightscub self_completion_intervweightscui self_completion_intervweightscus fed_forward_interv_outcome_iser fed_forward_ever_interv_iser interview_waveentry_iser sample_origin_household sample_origin_individual hhethnicminoritysample_dv individinterview_proxy_catnew interviewstartdate_year interviewdate_year_individual interviewdate_month_individual countryofresidence sex_dv_catnew ethn_dv ethn_dv_catnew ethn_dv_source racel_dv newbornuk_dv migration_generation birthy ageentrypanel_50plus5years ageentrypan_50plus5catce65to69 ageentrypan_50plus5catce65to69sq ageentrypanel_3cat ageentrypanel_16plus5years ageentrypan_16plus5catce45to49 ageentrypan_16plus5catce45to49sq ageentrypanel_50plus9years ageentrypan_50plus9catce68to76 ageentrypan_50plus9catce68to76sq ageatinterview_dv ageatinterview_dv_sq agein2010 agegr10_dv ageatinterview_dv_categories50 ageatinterview_dv_categories16 dead ageatdeath deathinwaverecorded_new wave_last_enumerated wave_last_interviewed deathyear education_highest education_highest_catnew mastat_dv mastat_dv_catnew cohab_dv bmi_dv numbercigarettes economicactivivity_current jobcurrent_nssec_classification jobcurrent_nssec_classification3 urbanruralresidence hospitalinpatient_yn hospitalinpatient_days hhincomenet_dv disdif_mobilityFI disdif_movingobjectsFI disdif_manualdexterityFI disdif_continenceFI disdif_hearingFI disdif_sightFI disdif_communicationFI disdif_concentratingabbilityFI disdif_recognisingdangerFI disdif_physicalcoordinationFI disdif_difficultiescareFI disdif_otherhealthproblemsFI angina arthr asthma bron diab emphys /*epilep*/ hatmi hf hyperte /*hypothy*/ liver malig stroke scs_generalhealth_scsf1_scFI scs_hl_painworkFI scs_hl_feeling_calmFI scs_hl_having_eneryFI scs_hl_moderateactivitiesFI scs_hl_climbingstairsFI scs_hl_workFI scs_hl_kindofworkFI scs_hl_emotionalprob_laccomplFI scs_hl_emotionalprob_lescarfulFI scs_hl_feeling_depressedFI scs_hl_emotionalprobsocialactFI missing_covariate; # delimit cr * Negative correlation foreach var of varlist asthma scs_hl_feeling_calmFI scs_hl_feeling_depressedFI { correlate `var' ageatinterview_dv } * Spearman foreach var of varlist disdif_movingobjectsFI-scs_hl_emotionalprobsocialactFI { spearman `var' ageatinterview_dv } *asdoc spearman `var' ageatinterview_dv , mi append save($tables\unbalanced panel\7waves\FIitems_correlation spearman.doc) * postive correlation above foreach var of varlist arthr scs_hl_painworkFI { spearman `var' ageatinterview_dv } * Negative correlation above foreach var of varlist asthma scs_hl_feeling_calmFI scs_hl_feeling_depressedFI { spearman `var' ageatinterview_dv } * Pairwise correlation: health conditions, disabilities, health limitations spearman angina arthr asthma bron diab emphys hatmi hf hyperte liver malig stroke disdif_mobilityFI disdif_movingobjectsFI disdif_manualdexterityFI disdif_continenceFI disdif_hearingFI disdif_sightFI disdif_communicationFI disdif_concentratingabbilityFI disdif_recognisingdangerFI disdif_physicalcoordinationFI disdif_difficultiescareFI disdif_otherhealthproblemsFI scs_generalhealth_scsf1_scFI scs_hl_painworkFI scs_hl_feeling_calmFI scs_hl_having_eneryFI scs_hl_moderateactivitiesFI scs_hl_climbingstairsFI scs_hl_workFI scs_hl_kindofworkFI scs_hl_emotionalprob_laccomplFI scs_hl_emotionalprob_lescarfulFI scs_hl_feeling_depressedFI scs_hl_emotionalprobsocialactFI esttab using "$tables\unbalanced panel\FI candidates correlation.csv", replace * Harmoning the time axis gen byte wave_allstart_t1=wave if interview_waveentry_iser==1 replace wave_allstart_t1=wave - (interview_waveentry_iser - 1) if interview_waveentry_iser!=1 tab wave_allstart_t1 * Creating further additional multilevel model variables clonevar cohortage50=ageentrypanel_50plus5years clonevar cohortage16=ageentrypanel_16plus5years gen int cohortage50square=cohortage50^2 gen int cohortage16square=cohortage16^2 gen int IA_wave_cohortage50=wave_allstart_t1*cohortage50 gen int IA_wave_cohortage16=wave_allstart_t1*cohortage16 gen byte ageatinterview_dv_cohage50_diff=(ageatinterview_dv - cohortage50) + 1 gen byte ageatinterview_dv_cohage16_diff=(ageatinterview_dv - cohortage16) + 1 sum cohortage50 cohortage50square IA_wave_cohortage50 IA_wave_cohortage16 ageatinterview_dv_cohage50_diff ageatinterview_dv_cohage16_diff * Control for correct tabulation of cohortage and ageatinterview_dv tab1 cohortage50 cohortage16 ageatinterview_dv_cohage50_diff, mi tab2 ageatinterview_dv cohortage50 if wave==1, mi tab2 ageatinterview_dv cohortage16 if wave==1, mi ******************************************************************************** *FI domains * Missing data over all FI items mdesc disdif_mobilityFI-disdif_otherhealthproblemsFI angina-stroke scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI * FI items missing in domains of the FI egen byte FInumbermissingvaluesdisdifvar =rowmiss(disdif_mobilityFI-disdif_otherhealthproblemsFI) egen byte FInumbermissingvalueshcondvar =rowmiss(angina-stroke) egen byte FInumbermissingvaluesscshlvar =rowmiss(scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI) egen byte FInumbermissingvaluesvariablsall =rowmiss(angina-stroke disdif_mobilityFI-disdif_otherhealthproblemsFI scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI) * Indicator variables observation with no missingness in FI items gen byte FInumbermissingvalues_NE0=0 replace FInumbermissingvalues_NE0=1 if FInumbermissingvaluesvariablsall>=1 gen byte missingvalue_covariatFIitem=0 replace missingvalue_covariatFIitem=1 if (missing_covariate==1 | FInumbermissingvalues_NE0==1) * Descriptive statistics missing values sum FInumbermissingvalues* missingvalue_covariatFIitem tab1 FInumbermissingvalues* missing_covariate FInumbermissingvalues_NE0 missingvalue_covariatFIitem missingvalue_covariatFIitem, mi hist FInumbermissingvaluesvariablsall, percent title("FI candidates with number of missing items") subtitle("without any sample restriction: age") note("12 items missing: 1 domain (hc or hl) + 24 items missing: 2 domains (hc+hl) + 36 items missing: 3 domains") ******************************************************************************** * Label display /*foreach v of varlist disdif_mobilityFI-disdif_otherhealthproblemsFI angina-stroke scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI { display `"`:var label `v''"' }*/ * FI calculation * Disabilities egen byte FIcompdisabilities = rowtotal(disdif_mobilityFI-disdif_otherhealthproblemsFI) egen byte FIcompdisabilitiesnonmiss = rownonmiss(disdif_mobilityFI-disdif_otherhealthproblemsFI) * Health conditions egen byte FIcomphealthconditions = rowtotal(angina-stroke) egen byte FIcomphealthconditionsnonmiss = rownonmiss(angina-stroke) * Health limitations egen byte FIcompscshealthlimit = rowtotal(scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI) egen byte FIcompscshealthlimitnonmiss = rownonmiss(scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI) *Sum FI score unrestricted with all 3 domain egen byte FI_items_sum = rowtotal(disdif_mobilityFI-scs_hl_emotionalprobsocialactFI) egen byte FI_items_nonmissing = rownonmiss(disdif_mobilityFI-scs_hl_emotionalprobsocialactFI) * Hist control hist FInumbermissingvaluesvariablsall, percent hist FI_items_nonmissing, percent * Wave 2 because hcond tab FI_items_nonmissing if interview_waveentry_iser==1, mi tab FI_items_nonmissing if interview_waveentry_iser==2, mi tab FI_items_nonmissing if interview_waveentry_iser==3, mi tab FI_items_nonmissing if (sample_origin_individual==7 & interview_waveentry_iser==1) tab FI_items_nonmissing if (sample_origin_individual==7 & interview_waveentry_iser==2) *Sum FI score restricted with 2 domains and without disabilities + with 2 domains and without health conditions * without disabilities egen byte FI_items_sum_resrwodisdif = rowtotal(angina-scs_hl_emotionalprobsocialactFI) egen byte FI_items_nonmissing_resrwodisdif = rownonmiss(angina-scs_hl_emotionalprobsocialactFI) * without health conditions egen byte FI_items_sum_resrwohcond = rowtotal(disdif_mobilityFI-disdif_otherhealthproblemsFI scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI) egen byte FI_items_nonmissing_resrwohcond = rownonmiss(disdif_mobilityFI-disdif_otherhealthproblemsFI scs_generalhealth_scsf1_scFI-scs_hl_emotionalprobsocialactFI) * without health limitations egen byte FI_items_sum_resrwohealthlimit = rowtotal(disdif_mobilityFI-disdif_otherhealthproblemsFI angina-stroke) egen byte FI_items_nonmissing_resrwohlimit = rownonmiss(disdif_mobilityFI-disdif_otherhealthproblemsFI angina-stroke) * Control items nonmissing and sum mdesc FI_items_sum FI_items_nonmissing FI_items_sum_resrwodisdif FI_items_nonmissing_resrwodisdif FI_items_sum_resrwohcond FI_items_nonmissing_resrwohcond sum FI_items_sum FI_items_nonmissing FI_items_sum_resrwodisdif FI_items_nonmissing_resrwodisdif FI_items_sum_resrwohcond FI_items_nonmissing_resrwohcond * FI score and by domains + Scaling FI to be on 1 and 10 percent increases (0.01 and 0.1 unit increments on FI scale) gen FI_score = FI_items_sum/FI_items_nonmissing gen FI_100percent = FI_score*100 gen FI_10percent = FI_score*10 * categorised FI with 0.1 increments: egen FIcat_10percent = cut(FI_100percent), at(0,10,20,30,40,60) gen FI_score_ln=. replace FI_score_ln= ln(FI_score) if FI_score!=0 gen FI_score_restrictwodisdif = FI_items_sum_resrwodisdif/FI_items_nonmissing_resrwodisdif gen FI_score_restrictwohcond = FI_items_sum_resrwohcond/FI_items_nonmissing_resrwohcond gen FI_score_restrictwohlimit = FI_items_sum_resrwohealthlimit/FI_items_nonmissing_resrwohlimit gen FI_score_domdisabilities = FIcompdisabilities/FIcompdisabilitiesnonmiss gen FI_score_domhealthcond = FIcomphealthconditions/FIcomphealthconditionsnonmiss gen FI_score_domhealthlimit = FIcompscshealthlimit/FIcompscshealthlimitnonmiss * Listing for controlling FI_score sum FI_score* tab1 FI_score* * Descriptive statistics FI score for waves 1-3 without hcond sum FI_score FI_score_restrictwohcond if wave==1 sum FI_score FI_score_restrictwohcond if wave==2 sum FI_score FI_score_restrictwohcond if wave==3 sum FI_score FI_score_restrictwohcond if interview_waveentry_iser==1 sum FI_score FI_score_restrictwohcond if interview_waveentry_iser==2 sum FI_score FI_score_restrictwohcond if interview_waveentry_iser==3 hist FI_score, bin(500) percent title("FI score") subtitle("none of 3 restrictions: sample_origin, number of missing items, age") note("FI score=1 only few items arecoded as 1, all other FI items missing") * Frailty index categorisation * https://bmcgeriatr.biomedcentral.com/articles/10.1186/s12877-021-02671-3#Sec11 egen byte FI_score_cat1 = cut(FI_score), at(0, 0.03, 0.10, 0.21, 0.45, 1.0) label egen byte FI_score_cat2 = cut(FI_score), at(0, 0.10, 0.21, 1.0) label egen byte FI_score_cat3 = cut(FI_score), at(0, 0.081, 0.251, 1.0) label egen byte FI_score_cat4 = cut(FI_score), at(0, 0.10, 0.20, 0.30, 0.40, 1.0) label * Control for cut label tab1 FI_score_cat1 FI_score_cat2 FI_score_cat3 FI_score_cat4 tab1 FI_score_cat1 FI_score_cat2 FI_score_cat3 FI_score_cat4, nolabel tabstat FI_score, by(FI_score_cat3) stats(min max) * Only Linked NHS with HES data available tab2 us_nhs_hes healthdatalinkagew8, mi label variable ageatinterview_dv_cohage50_diff "ageatinterview_dv - cohortage50" label variable ageatinterview_dv_cohage16_diff "ageatinterview_dv - cohortage16" label variable wave_allstart_t1 "Harmonised time axis: all respondents start at t1" label variable cohortage50square "Cohortage50 square" label variable cohortage16square "Cohortage16 square" label variable IA_wave_cohortage50 "IA wave_allstart_t1*cohortage50" label variable IA_wave_cohortage16 "IA wave_allstart_t1*cohortage16" label variable FInumbermissingvalues_NE0 "FI number of missing items >=1" label variable FI_items_nonmissing "FI items non-missing" label variable FI_items_nonmissing_resrwodisdif "FI items non-missing without disabililities" label variable FI_items_nonmissing_resrwohcond "FI items non-missing without health conditions" label variable FI_items_nonmissing_resrwohlimit "FI items non-missing without health limitations" label variable FInumbermissingvaluesdisdifvar "FI number of missing values in domain disdifvar" label variable FInumbermissingvalueshcondvar "FI number of missing values in domain hcond" label variable FInumbermissingvaluesscshlvar "FI number of missing values in domain scshlvar" label variable FInumbermissingvaluesvariablsall "FI number of missing values total" label variable FI_items_sum "FI items sum of all items" label variable FI_items_sum_resrwodisdif "FI items sum without disabilities" label variable FI_items_sum_resrwohcond "FI items sum without health conditions" label variable FI_items_sum_resrwohealthlimit "FI items sum without health limitations" label variable FI_score "FI score" label variable FI_10percent "FI 0.10 unit increments on FI scale" label variable FI_100percent "FI 0.01 unit increments on FI scale" label variable FIcat_10percent "FI categorised FI 0.1 increments" label variable FI_score_ln "FI score ln" label variable FI_score_domdisabilities "FI score domain disabilities" label variable FI_score_domhealthcond "FI score health conditions" label variable FI_score_domhealthlimit "FI score health limitations" label variable FI_score_restrictwodisdif "FI score without disabilities" label variable FI_score_restrictwohcond "FI score without health conditions" label variable FI_score_restrictwohlimit "FI score without health limitations" label variable FIcompdisabilities "FI component rowtotal disabilities" label variable FIcompdisabilitiesnonmiss "FI component rowtotal disabilities nonmissing" label variable FIcomphealthconditions "FI component rowtotal health conditions" label variable FIcomphealthconditionsnonmiss "FI component rowtotal health conditions nonmissing" label variable FIcompscshealthlimit "FI component rowtotal health limitations" label variable FIcompscshealthlimitnonmiss "FI component rowtotal health limitations nonmissing" label variable missingvalue_covariatFIitem "missingvalue covariat or FI item" compress save "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis_AFTER RECODING ESTIMATION_temp.dta", replace ******************************************************************************** ***************************************************************************** * Selection Samples 1,2,7,8 + Non-missings values>=36 + cohortage>=50 use "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis_AFTER RECODING ESTIMATION_temp.dta" if ( (wave<=9) & (sample_origin_individual==1 | sample_origin_individual==2 | sample_origin_individual==7 | sample_origin_individual==8 ) & (FI_items_nonmissing>=36) /*& (ageentrypanel_50plus5years!=. )*/ ), clear # delimit ; table1_mc, by(wave) vars( disdif_mobilityFI cat \ disdif_movingobjectsFI cat \ disdif_manualdexterityFI cat \ disdif_continenceFI cat \ disdif_hearingFI cat \ disdif_sightFI cat \ disdif_communicationFI cat \ disdif_concentratingabbilityFI cat \ disdif_recognisingdangerFI cat \ disdif_physicalcoordinationFI cat \ disdif_difficultiescareFI cat \ disdif_otherhealthproblemsFI cat \ angina cat \ arthr cat \ asthma cat \ bron cat \ diab cat \ emphys cat \ hatmi cat \ hf cat \ hyperte cat \ liver cat \ malig cat \ stroke cat \ scs_generalhealth_scsf1_scFI cat \ scs_hl_moderateactivitiesFI cat \ scs_hl_climbingstairsFI cat \ scs_hl_workFI cat \ scs_hl_kindofworkFI cat \ scs_hl_emotionalprob_laccomplFI cat \ scs_hl_emotionalprob_lescarfulFI cat \ scs_hl_painworkFI cat \ scs_hl_feeling_calmFI cat \ scs_hl_having_eneryFI cat \ scs_hl_feeling_depressedFI cat \ scs_hl_emotionalprobsocialactFI cat \ ) percent onecol missing nospace clear ; # delimit cr drop N_* m_* pvalue table1_mc_dta2docx using "$tables\unbalanced panel\9waves\doc\FI candidates descriptivestatistics as numeric values recoded by wave with all 3 sample sample restriction unbalanced panel.docx", append footnote("") landscape font("Arial Narrow", 8) datafont("Arial Narrow", 7) tablenumber("Table A3b") tabletitle("Descriptive statistics of FI candidates by wave in the unbalanced panel: disabilities or difficulties, health conditions and health limitations: complete case analysis with 36 FI items") *****/ ******************************************************************************** * Sample selection use "$outpath/hcond_cumulated_waveentry1stDnyEQ10mis_AFTER RECODING ESTIMATION_temp.dta", clear * sample selection: number of missing items, sample_origin, age sum ageatinterview_dv ageentrypanel_50plus5years ageatinterview_dv_categories16 sample_origin_individual tab1 ageatinterview_dv ageentrypanel_50plus5years ageatinterview_dv_categories16 sample_origin_individual interview_waveentry_iser , mi tab1 ethn_dv wave, mi * Number of total observations before selection gen N_selection_before=_N distinct pidp ******************************************************************************** * First sample selection: sample_origin tab ethn_dv_catnew wave, mi * First sample selection: sample origin drop if (sample_origin_individual==3 | sample_origin_individual==4 | sample_origin_individual==5 | sample_origin_individual==6 ) tab sample_origin_individual tab ethn_dv_catnew wave, mi gen N_selection_afternonmissingssaor=_N distinct pidp * pidp | 330533 70863 * For analysing unbalanced panel 9 waves with gaps label variable N_selection_before "Number of total observations before selection" save "$outpath/frailtyindexlongfile_estimation_unbalanced panel_9waves_gaps analysing.dta", replace ******************************************************************************** * Second sample selection: number of missing items tab1 FI_items_nonmissing if ageatinterview_dv>=50, mi distinct pidp *hist FInumbermissingvaluesvariablsall if ageatinterview_dv>=50, percent *Figure 1: Number of FI items with complete information with sample restriction: age>=50 hist FI_items_nonmissing if ageatinterview_dv>=50, percent title("") subtitle("") note("") * Ethnicity samples * Appendix 11: FI candidates with number of complete items") subtitle("Ethnicity subsamples EMB and IEMB with sample restriction: age>=16 age>=50 hist FI_items_nonmissing if ageatinterview_dv>=50 & (sample_origin_individual==7 | sample_origin_individual==8), percent title("") subtitle("Ethnicity subsamples EMB and IEMB with two sample restrictions") note("") /*:age>=50*/ * Some respondents 1st appearance not answered all items drop if FI_items_nonmissing<36 gen N_selection_afternonmissingLE36=_N tab FI_items_nonmissing tab ethn_dv_catnew wave tab ethn_dv_catnew wave if ageentrypanel_50plus5years==., mi tab ethn_dv_catnew wave if ageentrypanel_50plus5years!=., mi tab ethn_dv_catnew wave if ageatinterview_dv_categories16==., mi tab ethn_dv_catnew wave if ageatinterview_dv_categories16!=., mi *tab2 FI_items_nonmissing FInumbermissingvaluesvariablsall distinct pidp tab ethn_dv_catnew wave, mi * pidp | 257196 58365 ******************************************************************************** * Third sample selection: age * Below age 50 * All included *Appendix 10: Sample sizes with complete FI information for different ethnicities below age 50 **tab ethn_dv_catnew wave if ageentrypanel_50plus5years==., mi tab1 ageatinterview_dv ageentrypanel_50plus5years, mi tab1 ageatinterview_dv ageentrypanel_50plus5years, mi nolabel tab1 ageatinterview_dv ageatinterview_dv_categories16, mi tab1 ageatinterview_dv ageatinterview_dv_categories16, mi nolabel drop if ageentrypanel_50plus5years==. *drop if ageatinterview_dv==. /* No effect */ tab1 ageatinterview_dv_categories16 ageatinterview_dv tab1 ageatinterview_dv_categories16 ageatinterview_dv *gen N_selection_afternonmissingsag50=_N gen N_selection_afternonmissingsag16=_N distinct pidp tab ethn_dv_catnew wave, mi * pidp | 102622 20801 tab1 wave interview_waveentry_iser interview_pidp_waveentry1st_Dny ageatinterview_dv FI_items_nonmissing ageentrypanel_50plus5years ageatinterview_dv_categories16 FI_items_nonmissing FInumbermissingvaluesvariablsall ******************************************************************************** * For checking inconsistencies sort pidp wave bysort pidp (wave): gen intvwcontr_pidp_waveentry1st_Dny = 1 if _n == 1 list pidp wave interview_waveentry_iser interview_pidp_waveentry1st_Dny if interview_pidp_waveentry1st_Dny!=1 in 1/1000 ******************************************************************************** distinct pidp sum FI_score_ln regress FI_score_ln ageatinterview_dv regress FI_score ageatinterview_dv * Control sample selection criteria distinct pidp tab1 wave sample_origin_individual FI_items_nonmissing ageentrypanel_50plus5years ageatinterview_dv_categories16 interview_waveentry_iser FI_score, mi preserve * Sample selection 3 steps table1_mc, vars( sample_origin_individual cat \ FI_items_nonmissing cat \ /*ageentrypanel_50plus5years*/ ageatinterview_dv_categories16 cat ) onecol missing nospace clear total(after) table1_mc_dta2docx using "$tables\unbalanced panel\9waves\doc\Covariates descriptivestatistics sample selection 3 steps.docx", append landscape tablenumber("Table XX") tabletitle("Descriptive statistics AFTER sample selection with 3 steps") footnote("") restore * Histograms H1 H2 mdesc FI_score if wave==1 * Figure 2: FI score with complete information from 36 items baseline (wave 1, age>=50) hist FI_score if wave==1, bins(500) percent title("") subtitle("") /*note("19,230 respondents with 19,230 observations in wave 1", span)*/ distinct pidp mdesc FI_score * Figure 3: FI score with complete information from 36 items all 9 waves, age>=50 hist FI_score , bins(500) percent title("") subtitle("") /*note("20,801 respondents with 102,622 observations", span)*/ * b) For creating a balanced panel bysort pidp (wave): gen byte obsnumperpidp_estimationbalanced = _n bysort pidp (wave): gen byte totnumperpidp_estimationbalanced = _N label variable obsnumperpidp_estimationbalanced "Particular number of observation per pidp in balanced panel" label variable totnumperpidp_estimationbalanced "Total number of observations per pidp in balanced panel" * c) Control age variablescohortage sum sample_origin_individual interview_waveentry_iser obsnumperpidp_estimationbalanced totnumperpidp_estimationbalanced wave wave_centered wave_centeredsq cohortage50 cohortage16 ageatinterview_dv tab1 wave wave_centered cohortage50 cohortage16 ageentrypanel_50plus5years ageentrypan_50plus5catce65to69, mi table (interview_waveentry_iser) (interview_pidp_waveentry1st_Dny wave), nototals /*option nototals not in Stata 15 */ * Descriptive statistics FI_items_* FI_score_dom* sum FI_items_* FI_score_dom* tab1 FI_items_nonmissing, mi ******************************************************************************** * Song X, Mitnitski A, Rockwood K. Prevalence and 10-year outcomes of frailty in older adults in relation to deficit accumulation. J Am Geriatr Soc. Apr;58(4):681–7. For example, in one of their studies they proposed FI ≤ 0.08 as `non-frail', FI ≥ 0.25 as `frail', and the rest as `pre-frail' (14). label variable FI_score_cat3 "FI categories:" label define FI_score_cat3_lab 0 "Non-frail (FI =< 0.08)" 1 "Pre-frail (0.08 < FI < 0.25)" 2 "Frail (0.25 =< FI =< 1.00)" label values FI_score_cat3 FI_score_cat3_lab ******************************************************************************** * One-stage design with sampling weight wvar*, strata defined by levels of svar, and sampling units identified by su1 svyset psu, strata(strata) *svyset *compress * Creation of the unbalanced panel: 9 waves tab1 wave totnumperpidp_estimationbalanced, mi sum ageatinterview_dv ageentrypanel_50plus5years ageatinterview_dv_categories16 sample_origin_individual tab1 ageatinterview_dv ageentrypanel_50plus5years ageatinterview_dv_categories16 sample_origin_individual, mi tab ethn_dv_catnew wave, mi drop N_selection_afternonmissings* label variable N_selection_afternonmissingLE36 "N Total number observations after selection sample1278_completecaseEQ36" label variable intvwcontr_pidp_waveentry1st_Dny "Wave first interview after 3 selection steps" save "$outpath/frailtyindexlongfile_estimation_unbalanced panel_9waves.dta", replace * Creation of the unbalanced panel: 7 waves drop if wave>=8 tab1 wave totnumperpidp_estimationbalanced, mi sum ageatinterview_dv ageentrypanel_50plus5years ageatinterview_dv_categories16 sample_origin_individual tab1 ageatinterview_dv ageentrypanel_50plus5years ageatinterview_dv_categories16 sample_origin_individual, mi save "$outpath/frailtyindexlongfile_estimation_unbalanced panel_7waves.dta", replace * 9 waves analysing use "$outpath/frailtyindexlongfile_estimation_unbalanced panel_9waves_gaps analysing.dta", clear distinct pidp tab1 FI_items_nonmissing FInumbermissingvalues_NE0 tab FI_items_nonmissing FInumbermissingvalues_NE0 keep pidp wave FInumbermissingvalues_NE0 FI_items_nonmissing FI_items_nonmissing disdif_mobilityFI-scs_hl_emotionalprobsocialactFI order pidp wave FInumbermissingvalues_NE0 FI_items_nonmissing disdif_mobilityFI-scs_hl_emotionalprobsocialactFI save "$outpath/frailtyindexlongfile_estimation_unbalanced panel_9waves_FI candidates_gaps analysing.dta", replace ******************************************************************************** * Creation of balanced panel * Creation balanced panel analysis * Restriction to balanced panel up to wave 9 use "$outpath/frailtyindexlongfile_estimation_unbalanced panel_9waves.dta", clear drop if totnumperpidp_estimationbalanced<=8 gen byte diff_wave_obsnumperpidp_estimat=wave - obsnumperpidp_estimation sum wave obsnumperpidp_estimation diff_wave_obsnumperpidp_estimat totnumperpidp_estimationbalanced tab1 wave sample_origin_individual label variable diff_wave_obsnumperpidp_estimat "wave - obsnumperpidp_estimation" drop diff_wave_obsnumperpidp_estimat save "$outpath/frailtyindexlongfile_estimation_balancedpanel_9waves.dta", replace ***************************** * Restriction to balanced panel up to wave 7 with droping waves 8 and 9 use "$outpath/frailtyindexlongfile_estimation_unbalanced panel_7waves.dta", clear tab1 wave totnumperpidp_estimationbalanced drop if wave>=8 drop if totnumperpidp_estimationbalanced<=6 gen byte totnumperpidp_estimationsample7=7 drop if wave!=obsnumperpidp_estimation bysort pidp (wave): gen byte totnumperpidp_estibalancedfor7w = _N tab2 totnumperpidp_estimationsample7 totnumperpidp_estibalancedfor7w drop if totnumperpidp_estimationsample7!=totnumperpidp_estibalancedfor7w gen byte diff_wave_obsnumperpidp_estimat=wave - obsnumperpidp_estimation sum totnumperpidp_estimationsample7 totnumperpidp_estibalancedfor7w diff_wave_obsnumperpidp_estimat tab wave label variable diff_wave_obsnumperpidp_estimat "wave - obsnumperpidp_estimation" label variable totnumperpidp_estimationsample7 "total number per pidp for estimation sample to at least 7 restricted" drop totnumperpidp_estimationsample7 totnumperpidp_estibalancedfor7w diff_wave_obsnumperpidp_estimat save "$outpath/frailtyindexlongfile_estimation_balancedpanel_7waves.dta", replace log close