*********************************************************************************************************************** ** Human Development Report Office (HDRO), United Nations Development Programme ** Multidimensional Poverty Index 2025 release ** Methodology developed in partnership with the Oxford Poverty and Human Development Initiative, University of Oxford ************************************************************************************************************************ clear all set more off set maxvar 10000 set mem 500m cap log close *** Working Folder Path *** global path_in "C:\UNDP\MPI\MPI_Computation\MPI_2025\National\Bolivia_2023\Bolivia_StataDatasets\" global path_out "C:\UNDP\MPI\MPI_Computation\MPI_2025\National\Bolivia_2023\Outputs\" global path_logs "C:\UNDP\MPI\MPI_Computation\MPI_2025\National\Bolivia_2023\" global path_qc "C:\UNDP\MPI\MPI_Computation\MPI_2025\National\Bolivia_2023\" global path_ado "C:" *** Log file *** log using "$path_logs/bol_EDSA23_dataprep.log", replace ******************************************************************************** *** Bolivia DHS 2023 *** ******************************************************************************** ******************************************************************************** *** Step 1: Data preparation *** Selecting variables from KR, BR, IR, & MR recode & merging with PR recode ******************************************************************************** /*Preparing for generating nutrition dataset. We merge the EDSA2023_Peso_talla_hemo.dta (anthropometric information) with EDSA2023_HOGAR.dta (date of interview and birth) datasets. */ use "$path_in/EDSA2023_Peso_talla_hemo.dta", clear count //46,581 samples duplicates report folio nro sort folio nro merge 1:1 folio nro using "$path_in/EDSA2023_HOGAR.dta" //54,008 samples drop _merge label variable hs01_0004b_2 "What is your date of birth? (Month)" label variable hs01_0004b_3 "What is your date of birth? (Year)" label variable hs01_0004b_1 "What is your date of birth? (Day)" label variable hs01_0101_1a "Household interview date - Day" label variable hs01_0101_1b "Household interview date - Month" label variable hs01_0101_1c "Household interview date - Year" sort folio nro rename ponderadorhviv ponderadorh generate temp1=subinstr(folio, "-", "", .) generate prefix=substr(temp1, 1, 9) generate letter=substr(temp1, 10, 1) generate suffix=substr(temp1, 11, .) generate letter_num="" replace letter_num="1" if letter=="A" replace letter_num="4" if letter=="D" generate string_id=prefix+letter_num+suffix destring string_id, gen (hh_id) gen str20 ind_id= string_id + string(nro, "%02.0f") *Individual ID stored as the string variable. duplicates report ind_id drop temp1 prefix letter suffix letter_num string_id *** Variable: SEX *** tab hs01_0003, miss //"1" for male ;"2" for female tab hs01_0003, nol clonevar gender = hs01_0003 lab def sex 1"male" 2"female" lab value gender sex label var gender "Sex" desc gender tab gender *** Variable: AGE *** gen str6 ageunit = "months" lab var ageunit "Months" gen mdate = mdy(hs01_0101_1b, hs01_0101_1a, hs01_0101_1c) gen bdate = mdy(hs01_0004b_2, hs01_0004b_1, hs01_0004b_3) if hs01_0004b_1 <= 31 //Calculate birth date in days from date of interview replace bdate = mdy(hs01_0004b_2, 15, hs01_0004b_3) if hs01_0004b_1 > 31 //If date of birth of child has been expressed as more than 31, we use 15 gen age_months = (mdate-bdate)/30.4375 //Calculate age in months with days expressed as decimals replace age_months = 0 if age_months<0 save "$path_out/bol23_PR.dta", replace ******************************************************************************** *** Step 1.1 KR - CHILDREN's RECODE (under 5) ******************************************************************************** use "$path_out/bol23_PR.dta", replace *** Next, indicate to STATA where the igrowup_restricted.ado file is stored: ***Source of ado file: http://www.who.int/childgrowth/software/en/ adopath + "C:\UNDP\MPI\WHO igrowup STATA\" *** We will now proceed to create three nutritional variables: *** weight-for-age (underweight), *** weight-for-height (wasting) *** height-for-age (stunting) /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Child Growth Standards are stored. Note that we use strX to specify the length of the path in string. If the path is long, you may specify str55 or more, so it will run. */ gen str100 reflib="C:\UNDP\MPI\WHO igrowup STATA\" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA dataset containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file (datalab_z_r_rc and datalab_prev_rc)*/ gen str30 datalab = "children_nutri_bol" lab var datalab "Working file" *** Next check the variables that WHO ado needs to calculate the z-scores: *** sex, age, weight, height count if age_months<60 count if hs01_0004a<5 *We use age_month to filter under-five children. keep if age_months<60 gen child_KR=1 //Generate identification variable for observations in KR recode *** Variable: BODY WEIGHT (KILOGRAMS) *** codebook hs05_0112, tab (10000) gen weight = hs05_0112 // Expressed in kilograms tab hs05_0112 if hs05_0112>990,m nol //Missing values are 994 to 996 replace weight = . if hs05_0112>=990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0112 if hs05_0112>=990 | hs05_0112==., miss //hs05_0116 : result of the measurement desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) codebook hs05_0113, tab (10000) gen height = hs05_0113 // Expressed in centimeters tab hs05_0113 if hs05_0113>9990,m nol //Missing values are 9994 to 9996 replace height = . if hs05_0113>=9990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0113 if hs05_0116>=9990 | hs05_0116==., miss desc height summ height *** Variable: MEASURED STANDING/LYING DOWN *** codebook hs05_0114 gen measure = "l" if hs05_0114==1 //Child measured lying down replace measure = "h" if hs05_0114==2 //Child measured standing up replace measure = " " if hs05_0114==9 | hs05_0114==0 | hs05_0114==. //Replace with " " if unknown desc measure tab measure *** Variable: OEDEMA *** lookfor oedema gen str1 oedema = "n" //It assumes no-one has oedema desc oedema tab oedema *** Variable: INDIVIDUAL CHILD SAMPLING WEIGHT *** gen sw = ponderador_npt desc sw summ sw /*We now run the command to calculate the z-scores with the adofile */ igrowup_restricted reflib datalib datalab gender age_months ageunit weight height measure oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to create the child nutrition variables following WHO standards */ use "$path_out/children_nutri_bol_z_rc.dta", clear *** Standard MPI indicator *** //Takes value 1 if the child is under 2 stdev below the median & 0 otherwise gen underweight = (_zwei < -2.0) replace underweight = . if _zwei == . | _fwei==1 lab var underweight "Child is undernourished (weight-for-age) 2sd - WHO" tab underweight, miss gen stunting = (_zlen < -2.0) replace stunting = . if _zlen == . | _flen==1 lab var stunting "Child is stunted (length/height-for-age) 2sd - WHO" tab stunting, miss gen wasting = (_zwfl < - 2.0) replace wasting = . if _zwfl == . | _fwfl == 1 lab var wasting "Child is wasted (weight-for-length/height) 2sd - WHO" tab wasting, miss rename age_months age_monthsUnder5 //Retain relevant variables: keep ind_id child_KR age_monthsUnder5 underweight stunting wasting order ind_id child_KR age_monthsUnder5 underweight stunting wasting sort ind_id duplicates report ind_id //Erase files from folder: erase "$path_out/children_nutri_bol_z_rc.xls" erase "$path_out/children_nutri_bol_prev_rc.xls" *erase "$path_out/children_nutri_bol_z_rc.dta" ***Additional codes for OPHI comparison gen stunted_a=stunting gen underweight_a=underweight gen chelg=child_KR foreach v in a { gen uw_st_`v' = 1 if stunted_`v'==1 | underweight_`v'==1 replace uw_st_`v' = 0 if stunted_`v'==0 & underweight_`v'==0 replace uw_st_`v' = . if stunted_`v'==. & underweight_`v'==. } //Save a temp file for merging with PR: save "$path_out/bol23_KR.dta", replace ******************************************************************************** *** Step 1.2 IR (children 60-71 months) ******************************************************************************** use "$path_out/bol23_PR.dta", replace *** Variable: Gender** bysort gender: sum hs05_0112 *** Variable: AGE *** sum age_month if hs05_0116!=. count if age_months>=60 & age_months<72 count if hs01_0004a==5 /* gen test1=1 if age_months>=60 & age_months<72 gen test2=1 if age_months>=60 & age_months<72 & hs05_0116!=. tab test1 test2, m browse hs01_0004a age_months hs05_0116 hs05_0112 hs05_0113 if test1==1 & test2==. */ *We use age "age_months" variable to filter 6 year's old children. keep if age_months>=60 & age_months<72 *** Variable: BODY WEIGHT (KILOGRAMS) *** codebook hs05_0112, tab (10000) gen weight = hs05_0112 // Expressed in kilograms tab hs05_0112 if hs05_0112>990,m nol //Missing values are 994 to 996 replace weight = . if hs05_0112>=990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0112 if hs05_0112>=990 | hs05_0112==., miss //hs05_0116 : result of the measurement desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) codebook hs05_0113, tab (10000) gen height = hs05_0113 // Expressed in centimeters tab hs05_0113 if hs05_0113>9990,m nol //Missing values are 9994 to 9996 replace height = . if hs05_0113>=9990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0113 if hs05_0116>=9990 | hs05_0116==., miss desc height summ height *** Variable: MEASURED STANDING/LYING DOWN *** codebook hs05_0114 gen measure = "l" if hs05_0114==1 //Child measured lying down replace measure = "h" if hs05_0114==2 //Child measured standing up replace measure = " " if hs05_0114==9 | hs05_0114==0 | hs05_0114==. //Replace with " " if unknown desc measure tab measure *** Variable: OEDEMA *** lookfor oedema gen str1 oedema = "n" //It assumes no-one has oedema desc oedema tab oedema *** Variable: INDIVIDUAL CHILD SAMPLING WEIGHT *** gen sw = ponderador_npt desc sw summ sw *** Next, indicate to STATA where the igrowup_restricted.ado file is stored: adopath + "C:\UNDP\MPI\who2007-stata\" /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Growth reference are stored. Note that we use strX to specity the length of the path in string. */ gen str100 reflib="C:\UNDP\MPI\who2007-stata" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA data set containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file*/ gen str30 datalab = "child_nutri60-71month_bol" lab var datalab "Working file" /*We now run the command to calculate the z-scores with the adofile */ who2007 reflib datalib datalab gender age_month ageunit weight height oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to compute BMI-for-age*/ use "$path_out/child_nutri60-71month_bol_z.dta", clear gen z_bmi = _zbfa replace z_bmi = . if _fbfa==1 lab var z_bmi "z-score bmi-for-age WHO" gen low_bmiage_c = (z_bmi < -2.0) /*Takes value 1 if BMI-for-age is under 2 stdev below the median & 0 otherwise */ replace low_bmiage_c = . if z_bmi==. lab var low_bmiage_c "Teenage low bmi 2sd - WHO" gen Child_IR=1 //Identification variable for observations in IR recode (girls 14-19 years and children ) rename age_month age_month_c //Retain relevant variables: keep ind_id Child_IR age_month_c low_bmiage_c order ind_id Child_IR age_month_c low_bmiage_c sort ind_id //Erase files from folder: erase "$path_out/child_nutri60-71month_bol_z.xls" erase "$path_out/child_nutri60-71month_bol_prev.xls" erase "$path_out/child_nutri60-71month_bol_z.dta" ///Additional code for OPHI gen chelg_6y=Child_IR gen ch_lbmiag_a=low_bmiage_c gen ch_agdays=age_month_c*30.4375 //Save a temp file for merging with PR: save "$path_out/bol23_IR_child60-71months.dta", replace ******************************************************************************** *** Step 1.3 BR - BIRTH RECODE *** (All females 12-49 years who ever gave birth) ******************************************************************************** use "$path_in/EDSA2023_HistorialHijos.dta", clear *** Generate individual unique key variable required for data merging *** Generate a household unique key variable at the household level using: generate temp1=subinstr(folio, "-", "", .) generate prefix=substr(temp1, 1, 9) generate letter=substr(temp1, 10, 1) generate suffix=substr(temp1, 11, .) generate letter_num="" replace letter_num="1" if letter=="A" replace letter_num="4" if letter=="D" generate string_id=prefix+letter_num+suffix destring string_id, gen (hh_id) gen str20 ind_id= string_id + string(nro, "%02.0f") *Individual ID stored as string variable drop temp1 prefix letter suffix letter_num string_id label var ms02_0216 "Birth number" duplicates report ind_id ms02_0216 label var b3 "Date of birth in CMC" label var v008 "Date of interview in CMC" *generating the age (month) when child died gen b7=ms02_0224_1 if ms02_0224==2 replace b7=ms02_0224_1/30.4375 if ms02_0224==1 replace b7=ms02_0224_1*12 if ms02_0224==3 gen date_death=b3+b7 ** Date of death = date of birth (b3) + age at death (b7) gen ddead_survey = v008 - date_death ** Days dead from survey = Date of interview (bcmc) - date of death gen ydead_survey = ddead_survey/12 ** Years dead from survey replace ydead_survey=0 if ydead_survey<0 *n=1 child had negative ydead_survey, likely due to how the child's death date is recorded in the sample. gen b5 = ms02_0220 codebook b5, tab (10) gen child_died = 1 if b5==2 //Redefine the coding and labels (1=child dead; 0=child alive) replace child_died = 0 if b5==1 replace child_died = . if b5==. label define lab_died 1 "child has died" 0 "child is alive", replace label values child_died lab_died tab b5 child_died, miss bysort ind_id: egen tot_child_died = sum(child_died) replace child_died=0 if b7>=216 & b7<. /* counting only deaths of children <18y (216 months) */ bysort ind_id: egen tot_child_died_5y=sum(child_died) if ydead_survey<=5 /*For each woman, sum the number of children who died in the past 5 years prior to the interview date */ replace tot_child_died_5y=0 if tot_child_died_5y==. & tot_child_died>=0 & tot_child_died<. /*All children who are alive and died longer than 5 years from the interview date are replaced as '0'*/ replace tot_child_died_5y=. if child_died==1 & ydead_survey==. //Replace as '.' if there is no information on when the child died tab tot_child_died tot_child_died_5y, miss bysort ind_id: egen child_died_per_wom = max(tot_child_died) lab var child_died_per_wom "Total child death for each women (birth recode)" bysort ind_id: egen child_died_per_wom_5y = max(tot_child_died_5y) lab var child_died_per_wom_5y "Total child death for each women in the last 5 years (birth recode)" //Keep one observation per women bysort ind_id: gen id2=1 if _n==1 keep if id2==1 drop id2 duplicates report ind_id gen women_BR = 1 //Identification variable for observations in BR recode //Retain relevant variables keep folio nro ind_id women_BR ms02_0220 child_died_per_wom child_died_per_wom_5y b7 order folio nro ind_id women_BR ms02_0220 child_died_per_wom child_died_per_wom_5y b7 sort ind_id //Save a temp file for merging with PR: save "$path_out/bol23_BR.dta", replace ******************************************************************************** *** Step 1.4 IR - WOMEN's RECODE *** (All eligible females 15-49 years in the household) ******************************************************************************** use "$path_in/EDSA2023_Mujer.dta", clear ** 14,545 women aged 15-49y generate temp1=subinstr(folio, "-", "", .) generate prefix=substr(temp1, 1, 9) generate letter=substr(temp1, 10, 1) generate suffix=substr(temp1, 11, .) generate letter_num="" replace letter_num="1" if letter=="A" replace letter_num="4" if letter=="D" generate string_id=prefix+letter_num+suffix destring string_id, gen (hh_id) gen str20 ind_id= string_id + string(nro, "%02.0f") *Individual ID stored as string variable duplicates report ind_id drop temp1 prefix letter suffix letter_num string_id label var ind_id "Individual ID" codebook ind_id duplicates report ind_id gen women_IR=1 //Identification variable for observations in IR recode keep folio nro ind_id women_IR /*v003 v005 v012*/ ms02_0201 ms02_0206 ms02_0207_1 ms06_0601 ms02_0207_2 ms06_0606 order folio nro ind_id women_IR /*v003 v005 v012*/ ms02_0201 ms02_0206 ms02_0207_1 ms06_0601 ms02_0207_2 ms06_0606 sort ind_id //Save a temp file for merging with PR: save "$path_out/bol23_IR.dta", replace ******************************************************************************** *** Step 1.5 Female ANTHROPOMETRY *** (Female 6-59 years) ******************************************************************************** ** Teen girls 6-19 yrs ** ** Calculate BMI ***** ********************** use "$path_out/bol23_PR.dta", replace ta hs05_0098 hs01_0003, m *** Variable: Gender** bysort gender: sum hs05_0095 *** Variable: AGE *** sum age_month if hs05_0095!=. count if age_months>=72 & age_months<240 count if hs01_0004a>=6 & hs01_0004a<=19 *We use the age "hs01_0004a" variable to filter female aged 6-19 years keep if hs01_0004a>=6 & hs01_0004a<=19 & gender==2 *** Variable: BODY WEIGHT (KILOGRAMS) *** codebook hs05_0095, tab (10000) gen weight = hs05_0095 // Expressed in kilograms tab hs05_0095 if hs05_0095>990,m nol //Missing values are 994 to 996 replace weight = . if hs05_0095>=990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0095 if hs05_0095>=990 | hs05_0095==., miss //hs05_0116 : result of the measurement desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) codebook hs05_0096, tab (10000) gen height = hs05_0096 // Expressed in centimeters tab hs05_0096 if hs05_0096>9990,m nol //Missing values are 9994 to 9996 replace height = . if hs05_0096>=9990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0096 if hs05_0096>=9990 | hs05_0096==., miss desc height summ height *** Variable: OEDEMA *** lookfor oedema gen str1 oedema = "n" //It assumes no-one has oedema desc oedema tab oedema *** Variable: INDIVIDUAL CHILD SAMPLING WEIGHT *** gen sw = ponderador_npt desc sw summ sw *** Next, indicate to STATA where the igrowup_restricted.ado file is stored: adopath + "C:\UNDP\MPI\who2007-stata\" /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Growth reference are stored. Note that we use strX to specity the length of the path in string. */ gen str100 reflib="C:\UNDP\MPI\who2007-stata" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA data set containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file*/ gen str30 datalab = "girls_nutri_bol" lab var datalab "Working file" /*We now run the command to calculate the z-scores with the adofile */ who2007 reflib datalib datalab gender age_month ageunit weight height oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to compute BMI-for-age*/ use "$path_out/girls_nutri_bol_z.dta", clear gen z_bmi = _zbfa replace z_bmi = . if _fbfa==1 lab var z_bmi "z-score bmi-for-age WHO" gen low_bmiage = (z_bmi < -2.0) /*Takes value 1 if BMI-for-age is under 2 stdev below the median & 0 otherwise */ replace low_bmiage = . if z_bmi==. lab var low_bmiage "Teenage low bmi 2sd - WHO" gen girls_IR=1 label var girls_IR "nutrition for girls 6-19 years" //Identification variable for observations in IR recode (girls 14-19 years and children ) //Retain relevant variables: keep folio nro ind_id girls_IR age_month low_bmiage order folio nro ind_id girls_IR age_month low_bmiage sort ind_id //Erase files from folder: erase "$path_out/girls_nutri_bol_z.xls" erase "$path_out/girls_nutri_bol_prev.xls" erase "$path_out/girls_nutri_bol_z.dta" ***Additional code for OPHI gen ng_id=girls_IR gen f_agmth=age_months gen f_lbmiag_a=low_bmiage //Save a temp file for merging with IR: save "$path_out/bol23_IR_girls6-19.dta", replace ******************* ** Women 15-59 ** ** Calculate BMI ** ******************* use "$path_out/bol23_PR.dta", replace *** Variable: SEX *** bysort gender: sum (hs05_0095) *** Variable: AGE *** gen age1=floor(age_month/12) count if age1!=hs01_0004a *n=104 samples age in years different than computed years. compare age1 hs01_0004a keep if hs01_0004a>=15 & gender==2 ** 15-59 years *** Variable: BODY WEIGHT (KILOGRAMS) *** codebook hs05_0095, tab (10000) gen weight = hs05_0095 // Expressed in kilograms tab hs05_0095 if hs05_0095>990,m nol //Missing values are 994 to 996 replace weight = . if hs05_0095>=990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0095 if hs05_0095>=990 | hs05_0095==., miss //hs05_0116 : result of the measurement desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) codebook hs05_0096, tab (10000) gen height = hs05_0096 // Expressed in centimeters tab hs05_0096 if hs05_0096>9990,m nol //Missing values are 9994 to 9996 replace height = . if hs05_0096>=9990 //All missing values or out of range are replaced as "." tab hs05_0116 hs05_0096 if hs05_0096>=9990 | hs05_0096==., miss desc height summ height gen ha40 = weight/((height/100)^2) ** BMI (kg/m2) gen women_BMI=1 keep id nro ind_id age_months weight hs05_0095 height hs05_0096 ha40 women_BMI sort ind_id save "$path_out/bol23_IR_women15_59.dta", replace ******************************************************************************** *** Step 1.5 MR - MEN'S RECODE ***(All eligible men: 15-64 years in the household) ******************************************************************************** use "$path_in/EDSA2023_Hombre.dta", clear * 5,878 men generate temp1=subinstr(folio, "-", "", .) generate prefix=substr(temp1, 1, 9) generate letter=substr(temp1, 10, 1) generate suffix=substr(temp1, 11, .) generate letter_num="" replace letter_num="1" if letter=="A" replace letter_num="4" if letter=="D" generate string_id=prefix+letter_num+suffix destring string_id, gen (hh_id) gen str20 ind_id= string_id + string(nro, "%02.0f") *Individual ID stored as string variable duplicates report ind_id drop temp1 prefix letter suffix letter_num string_id gen men_MR=1 //Identification variable for observations in IR recode keep folio nro ind_id men_MR vs02_0201 vs02_0206 vs02_0207_1 vs02_0207_2 vs04_0401 vs04_0402 vs04_0405 order folio nro ind_id men_MR vs02_0201 vs02_0206 vs02_0207_1 vs02_0207_2 vs04_0401 vs04_0402 vs04_0405 sort ind_id //Save a temp file for merging with PR: save "$path_out/bol23_MR.dta", replace ******************* ** Teen boys 6-19 ** ** Calculate BMI ** ******************* use "$path_out/bol23_PR.dta", replace *** Variable: SEX *** bysort gender: sum (hs05_0103) *** Variable: AGE *** sum age_month if hs05_0103!=. count if age_months>=72 & age_months<240 count if hs01_0004a>=6 & hs01_0004a<=19 *We use age "hs01_0004a" variable to filter the boys aged 6-19 years. keep if hs01_0004a>=6 & hs01_0004a<=19 & gender==1 *** Variable: BODY WEIGHT (KILOGRAMS) *** codebook hs05_0103, tab (10000) gen weight = hs05_0103 // Expressed in kilograms tab hs05_0103 if hs05_0103>990,m nol //Missing values are 994 to 996 replace weight = . if hs05_0103>=990 //All missing values or out of range are replaced as "." tab hs05_0106 hs05_0103 if hs05_0103>=990 | hs05_0103==., miss //hs05_0106 : result of the measurement desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) codebook hs05_0104 , tab (10000) gen height = hs05_0104 // Expressed in centimeters tab hs05_0104 if hs05_0104 >9990,m nol //Missing values are 9994 to 9996 replace height = . if hs05_0104 >=9990 //All missing values or out of range are replaced as "." tab hs05_0106 hs05_0104 if hs05_0104>=990 | hs05_0104==., miss //hs05_0106 : result of the measurement desc height summ height *** Variable: OEDEMA *** lookfor oedema gen str1 oedema = "n" //It assumes no-one has oedema desc oedema tab oedema *** Variable: INDIVIDUAL CHILD SAMPLING WEIGHT *** gen sw = ponderador_npt desc sw summ sw *** Next, indicate to STATA where the igrowup_restricted.ado file is stored: adopath + "C:\UNDP\MPI\who2007-stata\" /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Growth reference are stored. Note that we use strX to specity the length of the path in string. */ gen str100 reflib="C:\UNDP\MPI\who2007-stata" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA data set containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file*/ gen str30 datalab = "boys_nutri_bol" lab var datalab "Working file" /*We now run the command to calculate the z-scores with the adofile */ who2007 reflib datalib datalab gender age_month ageunit weight height oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to compute BMI-for-age*/ use "$path_out/boys_nutri_bol_z.dta", clear gen z_bmi = _zbfa replace z_bmi = . if _fbfa==1 lab var z_bmi "z-score bmi-for-age WHO" gen low_bmiage_b = (z_bmi < -2.0) /*Takes value 1 if BMI-for-age is under 2 stdev below the median & 0 otherwise */ replace low_bmiage_b = . if z_bmi==. lab var low_bmiage "Teenage low bmi 2sd - WHO" gen boys_IR=1 label var boys_IR "nutrition for boys 6-18 years" //Identification variable for observations in IR recode (boys 6-18 years) rename age_month age_month_b //Retain relevant variables: keep folio nro ind_id boys_IR age_month_b low_bmiage_b order folio nro ind_id boys_IR age_month_b low_bmiage_b sort ind_id //Erase files from folder: erase "$path_out/boys_nutri_bol_z.xls" erase "$path_out/boys_nutri_bol_prev.xls" erase "$path_out/boys_nutri_bol_z.dta" ***CODES for OPHI gen m_agmth= age_month_b gen nb_id= boys_IR gen m_lbmiag_a= low_bmiage_b tab1 nb_id m_lbmiag_a //Save a temp file for merging with PR: save "$path_out/bol23_IR_boys6-19.dta", replace ******************* ** Men 15-59 ** ** Calculate BMI ** ******************* use "$path_out/bol23_PR.dta", replace *** Variable: SEX *** bysort gender: sum (hs05_0103) *** Variable: AGE *** gen age1=floor(age_month/12) count if age1!=hs01_0004a *n=157 samples age in years different than computed years. compare age1 hs01_0004a *We will proceed with age_month variable count if age_months>=180 count if hs01_0004a>=15 keep if hs01_0004a>=15 & gender==1 ** 15-59 years *** Variable: BODY WEIGHT (KILOGRAMS) *** codebook hs05_0103, tab (100) gen weight = hs05_0103 // Expressed in kilograms tab hs05_0103 if hs05_0103>990,m nol //Missing values are 994 to 996 replace weight = . if hs05_0103>=990 //All missing values or out of range are replaced as "." tab hs05_0106 hs05_0103 if hs05_0103>=990 | hs05_0103==., miss //hs05_0106 : result of the measurement desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) codebook hs05_0104, tab (100) gen height = hs05_0104 // Expressed in centimeters tab hs05_0104 if hs05_0104>9990,m nol //Missing values are 9994 to 9996 replace height = . if hs05_0104>=9990 //All missing values or out of range are replaced as "." tab hs05_0106 hs05_0104 if hs05_0104>=9990 | hs05_0104==., miss desc height summ height gen hb40 = weight/((height/100)^2) ** BMI (kg/m2) gen Men_BMI=1 keep folio nro ind_id age_months weight hs05_0103 height hs05_0104 hs05_0106 hb40 Men_BMI sort ind_id save "$path_out/bol23_IR_men15_59.dta", replace *********************** ** HH variables ** *********************** use "$path_in/EDSA2023_Vivienda.dta", clear generate temp1=subinstr(folio, "-", "", .) generate prefix=substr(temp1, 1, 9) generate letter=substr(temp1, 10, 1) generate suffix=substr(temp1, 11, .) generate letter_num="" replace letter_num="1" if letter=="A" replace letter_num="4" if letter=="D" generate string_id=prefix+letter_num+suffix destring string_id, gen (hh_id) duplicates report hh_id drop temp1 prefix letter suffix letter_num string_id save "$path_out/bol23_hh.dta", replace ******************************************************************************** *** Step 1.7 PR - HOUSEHOLD MEMBER'S RECODE ******************************************************************************** use "$path_in/EDSA2023_HOGAR.dta", clear *We will proceed with using this dataset. gen cty = "Bolivia" gen ccty = "BOL" gen year = "2023" gen survey = "EDSA" generate temp1=subinstr(folio, "-", "", .) generate prefix=substr(temp1, 1, 9) generate letter=substr(temp1, 10, 1) generate suffix=substr(temp1, 11, .) generate letter_num="" replace letter_num="1" if letter=="A" replace letter_num="4" if letter=="D" generate string_id=prefix+letter_num+suffix destring string_id, gen (hh_id) gen str20 ind_id= string_id + string(nro, "%02.0f") *Individual ID stored as the string variable. duplicates report ind_id drop temp1 prefix letter suffix letter_num string_id format hh_id %20.0g label var hh_id "Household ID" codebook hh_id label var ind_id "Individual ID as string" codebook ind_id duplicates report ind_id sort hh_id ind_id *Total individual member samples (n=54,008) *** Variable: SEX *** tab hs01_0003, miss clonevar gender = hs01_0003 lab def sex 1"male" 2"female" lab value gender sex label var gender "Sex" tab gender ******************************************************************************** *** 1.8 DATA MERGING ******************************************************************************** *** Merging BR Recode ***************************************** merge 1:1 ind_id using "$path_out/bol23_BR.dta" drop _merge erase "$path_out/bol23_BR.dta" *** Merging IR Recode ***************************************** merge 1:1 ind_id using "$path_out/bol23_IR.dta" tab hs01_0004a gender if women_IR ==1 *14,545 women aged 12 to 49 yrs gen temp = 1 if gender==2 & hs01_0004a>=12 & hs01_0004a<=49 tab women_IR temp, miss col *Total eligible women not interviewed = 114 drop temp _merge erase "$path_out/bol23_IR.dta" *** Merging IR Recode: 6-19 years girls + women 15-59 Nutrition data ******************************************************************* merge 1:1 ind_id using "$path_out/bol23_IR_girls6-19.dta" tab hs01_0004a gender if girls_IR ==1 gen temp=1 if gender==2 & hs01_0004a>=6 & hs01_0004a<=19 tab girls_IR temp if hs01_0004a>=6 & hs01_0004a<=19, miss col drop _merge temp erase "$path_out/bol23_IR_girls6-19.dta" *Merge with women aged 15-59 yrs merge 1:1 ind_id using "$path_out/bol23_IR_women15_59.dta" tab hs01_0004a if women_BMI ==1 *15,846 women aged 15-59 yrs gen temp=1 if gender==2 & hs01_0004a>=15 & hs01_0004a<=59 ta women_BMI temp,m drop _merge temp erase "$path_out/bol23_IR_women15_59.dta" *** Merging KR Recode Under-Five nutrition ***************************************** merge 1:1 ind_id using "$path_out/bol23_KR.dta" gen temp=1 if hs01_0004a>=0 & hs01_0004a<5 ta child_KR temp, m *4473/4489 children below 5 years were measured. drop _merge temp erase "$path_out/bol23_KR.dta" *** Merging children aged 60-71 months nutrition data ***************************************** merge 1:1 ind_id using "$path_out/bol23_IR_child60-71months.dta" gen temp=1 if hs01_0004a==5 ta Child_IR temp,m drop _merge temp erase "$path_out/bol23_IR_child60-71months.dta" *** Merging MR Recode (men) ***************************************** merge 1:1 ind_id using "$path_out/bol23_MR.dta" tab hs01_0004a gender if men_MR ==1 *5,878 men aged between 15 to 64 years. gen temp = 1 if gender==1 & hs01_0004a>=15 & hs01_0004a<=64 tab men_MR temp, miss col *Total number of men not interviewed = 10,386 (63.86% of total 16,264) *Need to check if there is an additional selection/eligibility criteria. drop temp _merge erase "$path_out/bol23_MR.dta" *** Merging IR Recode: 6-19 years boys + men 15-59 Nutrition data ******************************************************************* merge 1:1 ind_id using "$path_out/bol23_IR_boys6-19.dta" tab hs01_0004a gender if boys_IR ==1 *7,524 boys aged between 6-19 yrs. gen temp=1 if gender==1 & hs01_0004a>=6 & hs01_0004a<=19 tab boys_IR temp, miss col drop _merge temp erase "$path_out/bol23_IR_boys6-19.dta" *Merge with men aged 15-59 yrs merge 1:1 ind_id using "$path_out/bol23_IR_men15_59.dta" tab hs01_0004a if Men_BMI ==1 *15,227 men aged 15-59 yrs gen temp=1 if gender==1 & hs01_0004a>=15 & hs01_0004a<=59 ta Men_BMI temp,m *Men (15,224/ 15,282) aged 15-59 years were measured. drop _merge temp erase "$path_out/bol23_IR_men15_59.dta" ** Household variables ** merge m:1 hh_id using "$path_out/bol23_hh.dta" drop _merge ******************************************************************************** *** Step 1.9 KEEPING ONLY DE JURE HOUSEHOLD MEMBERS *** ******************************************************************************** //Permanent (de jure) household members clonevar resident = hs01_0011 label var resident "Permanent (de jure) household member" drop if resident==2 tab resident, miss /*Note: The Global MPI is based on de jure (permanent) household members only. As such, non-usual residents will be excluded from the sample.*/ ******************************************************************************** *** 1.10 CONTROL VARIABLES ******************************************************************************** /* Households are identified as having 'no eligible' members if there are no applicable population. As such, these households are considered as non-deprived in those relevant indicators.*/ ***Eligibility for child mortality ***************************************** *Female eligibility gen fem_eligible = (hs01_0004a>=12 & hs01_0004a<=49 & gender==2) bys hh_id: egen hh_n_fem_eligible = sum(fem_eligible) //Number of eligible women for interview in the hh gen no_fem_eligible = (hh_n_fem_eligible==0) //Takes value 1 if the household had no eligible females for an interview lab var no_fem_eligible "Household has no eligible women" tab no_fem_eligible, miss *Male eligibility gen male_eligible = (hs01_0004a>=15 & hs01_0004a<=64 & gender==1) bys hh_id: egen hh_n_male_eligible = sum(male_eligible) //Number of eligible men for interview in the hh gen no_male_eligible = (hh_n_male_eligible==0) //Takes value 1 if the household had no eligible females for an interview lab var no_male_eligible "Household has no eligible male" tab no_male_eligible, miss *No Female and Male eligibility ***************************************** gen no_eligibles= (no_fem_eligible==1 & no_male_eligible==1) lab var no_eligibles "Household has no eligible women or men" tab no_eligibles, miss drop fem_eligible hh_n_fem_eligible male_eligible hh_n_male_eligible sort hh_id ind_id ******************************************************************************** *** 1.11 SUBSAMPLE VARIABLE *** ******************************************************************************** /* In Bolivia DHS 2023, height and weight measurements were collected from children (0-5), women and male (6-59) */ gen subsample=1 label var subsample "Households selected as part of nutrition subsample" tab subsample, miss ******************************************************************************** *** 1.12 RENAMING DEMOGRAPHIC VARIABLES *** ******************************************************************************** //Sample weight desc ponderadorh drop weight clonevar weight = ponderadorh label var weight "Sample weight" //Area: urban or rural desc area codebook area, tab (5) *clonevar area = area replace area=0 if area==2 label define lab_area 1 "urban" 0 "rural" label values area lab_area label var area "Area: urban-rural" //Relationship to the head of household clonevar relationship = hs01_0005 codebook relationship, tab (20) recode relationship (1=1)(2=2)(3/4=3)(5/10=4)(11=5)(12/13=6) label define lab_rel 1"head" 2"spouse" 3"child" 4"extended family" /// 5"not related" 6"maid" label values relationship lab_rel label var relationship "Relationship to the head of household" tab hs01_0005 relationship, miss //Sex of household member codebook hs01_0003, tab (10) clonevar sex = hs01_0003 label var sex "Sex of household member" //Age of household member codebook hs01_0004a, tab (1000) clonevar age = hs01_0004a replace age = . if age>98 label var age "Age of household member" //Age group recode age (0/4 = 1 "0-4")(5/9 = 2 "5-9")(10/14 = 3 "10-14") /// (15/17 = 4 "15-17")(18/59 = 5 "18-59")(60/max=6 "60+"), gen(agec7) lab var agec7 "age groups (7 groups)" recode age (0/9 = 1 "0-9") (10/17 = 2 "10-17")(18/59 = 3 "18-59") /// (60/max=4 "60+"), gen(agec4) lab var agec4 "age groups (4 groups)" //Total number of de jure hh members in the household gen member = 1 bysort hh_id: egen hhsize = sum(member) label var hhsize "Household size" tab hhsize, miss drop member //Subnational region lookfor region departamento codebook departamento, tab(100) *codebook hv024, tab (100) *gen region = hv024 lab var region "Region for subnational decomposition" tab region, m ta departamento region,m ******************************************************************************** *** Step 2 Data preparation *** *** Standardization of the 10 Global MPI indicators *** Identification of non-deprived & deprived individuals ******************************************************************************** ******************************************************************************** *** Step 2.1 Years of Schooling *** ******************************************************************************** ** school entrance age: 6y ** duration of primary: 6y *School entrace ages for lower and upper secondary are 12 yrs and 14 yrs. *Theoritical duration of lower and upper secondary are 2 yrs and 4 yrs. codebook hs02_0022, tab (100) label var hs02_0022 "Can you read and write?" codebook hs02_0023, tab(100) label var hs02_0023 "Have you ever attended school, college, or university?" codebook hs02_0024_1, tab(100) label var hs02_0024_1 "What was the highest level of education you passed?" label define educationlevel 1"None" 2"Literacy course" 3"Pre-Kindergarten" 4"Basic1-5yrs" 5"Intermediate1-3yrs" /// 6"Middle 1-4yrs" 7"Elementary1-8yrs" 8"Secondary1-4yrs" 9"Primary1-6yrs" 10"Secondary1-6yrs" 11"TeacherTraining" /// 12 "Bachelor's degree" 13"Postgraduate degree" 14"Higher technical and intermediate technical degree1-3yrs" 15"MiliaryPolice Training" label values hs02_0024_1 educationlevel codebook hs02_0024_2, tab(100) label var hs02_0024_2 "course or grade level" tab hs02_0024_2 hs02_0024_1, m gen eduyears=. replace eduyears=0 if hs02_0024_1==1| hs02_0024_1==2| hs02_0024_1==3 *Assigning zero eduyears for No education, literacy cource and Pre-Kindergarden level replace eduyears=hs02_0024_2 if hs02_0024_1==4 replace eduyears=5+hs02_0024_2 if hs02_0024_1==5 replace eduyears=8+hs02_0024_2 if hs02_0024_1==6 replace eduyears=hs02_0024_2 if hs02_0024_1==7 replace eduyears=8+hs02_0024_2 if hs02_0024_1==8 replace eduyears=hs02_0024_2 if hs02_0024_1==9 replace eduyears=6+hs02_0024_2 if hs02_0024_1==10 replace eduyears=12+hs02_0024_2 if hs02_0024_1==11 | hs02_0024_1==12| hs02_0024_1==14| hs02_0024_1==15 *Assigning 12 years of education for Teacher's education, Bachelor level, Higher technical, and Military training. replace eduyears=17+hs02_0024_2 if hs02_0024_1==13 /*Assigning 17 years of education for Postgraduate education based on the ISCED classification. (Source: https://isced.uis.unesco.org/wp-content/uploads/sites/15/uis_isced_uploads/beb97cf962765b3795a10460efb83e13.jpg)*/ replace eduyears=0 if hs02_0022==2 | hs02_0023==2 *Can't read and write or never attended any school/colleage. tab eduyears hs02_0024_1, m tab age if eduyears==. *replace eduyears = . if eduyears>30 *recode any unreasonable years of highest education as missing value replace eduyears = . if eduyears>=age & age>0 replace eduyears = 0 if age < 10 replace eduyears = 0 if (age==10 | age==11) & eduyears < 6 /*A control variable is created on whether there is information on years of education for at least 2/3 of the household members. */ gen temp = 1 if (eduyears!=. & (age>=12 & age!=.)) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen no_missing_edu = sum(temp) /*Total household members who are 12 years and older with no missing years of education but recognizing as an achievement if the member is 10 or 11 and already completed 6 yrs of schooling */ gen temp2 = 1 if (age>=12 & age!=.) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen hhs = sum(temp2) *Total number of household members who are 12 years and older replace no_missing_edu = no_missing_edu/hhs replace no_missing_edu = (no_missing_edu>=2/3) /*Identify whether there is information on years of education for at least 2/3 of the household members aged 12 years and older */ tab no_missing_edu, miss label var no_missing_edu "No missing edu for at least 2/3 of the HH members aged 12 years & older" drop temp temp2 hhs /*The entire household is considered deprived if no household member aged 12 years or older has completed SIX years of schooling. */ gen years_edu6 = (eduyears>=6) /* The years of schooling indicator takes a value of "1" if at least someone in the hh has reported 6 years of education or more */ replace years_edu6 = . if eduyears==. bysort hh_id: egen hh_years_edu6_1 = max(years_edu6) gen hh_years_edu6 = (hh_years_edu6_1==1) replace hh_years_edu6 = . if hh_years_edu6_1==. replace hh_years_edu6 = . if hh_years_edu6==0 & no_missing_edu==0 lab var hh_years_edu6 "Household has at least one member with 6 years of edu" ******************************************************************************** *** Step 2.2 Child School Attendance *** ******************************************************************************** codebook hs02_0025, tab (10) label var hs02_0025 "Are you currently enrolled or registered for any education course or degree?" codebook hs02_0027, tab(10) label var hs02_0027 "Currently, do you attend the level and course you enrolled/maculate this 2023?" tab hs02_0025 hs02_0027, m /*Boliva EDSA 2023 survey has two identical variables for school attendance, hs02_0025 variable codes "Currently enrolled" and hs02_0027 variable codes "Currently enrolled in 2023. We proceed with hs02_0027 for now, but need to be verified.*/ gen attendance = 1 if hs02_0027==1 replace attendance = 0 if hs02_0027==2 | hs02_0023==2 | hs02_0025==2 *Recoding ever not attending school, and currently not enrolled from hs02_0025 variable as "zero" attendance. ******************************************************************* /*The entire household is considered deprived if any school-aged child is not attending school up to class 8. */ gen child_schoolage = (age>=6 & age<=14) /* Note: In Bolivia, the official school entrance age is 6 years. So, age range is 6-14 (=6+8) Source: http://data.uis.unesco.org/?ReportId=163. */ /*A control variable is created on whether there is no information on school attendance for at least 2/3 of the school age children */ count if child_schoolage==1 & attendance==. //Understand how many eligible school aged children are not attending school gen temp = 1 if child_schoolage==1 & attendance!=. /*Generate a variable that captures the number of eligible school aged children who are attending school */ bysort hh_id: egen no_missing_atten = sum(temp) /*Total school age children with no missing information on school attendance */ gen temp2 = 1 if child_schoolage==1 bysort hh_id: egen hhs = sum(temp2) //Total number of household members who are of school age replace no_missing_atten = no_missing_atten/hhs replace no_missing_atten = (no_missing_atten>=2/3) /*Identify whether there is missing information on school attendance for more than 2/3 of the school age children */ tab no_missing_atten, miss label var no_missing_atten "No missing school attendance for at least 2/3 of the school aged children" drop temp temp2 hhs bysort hh_id: egen hh_children_schoolage = sum(child_schoolage) replace hh_children_schoolage = (hh_children_schoolage>0) //Control variable: //It takes value 1 if the household has children in school age lab var hh_children_schoolage "Household has children in school age" gen child_not_atten = (attendance==0) if child_schoolage==1 replace child_not_atten = . if attendance==. & child_schoolage==1 bysort hh_id: egen any_child_not_atten = max(child_not_atten) gen hh_child_atten = (any_child_not_atten==0) replace hh_child_atten = . if any_child_not_atten==. replace hh_child_atten = 1 if hh_children_schoolage==0 replace hh_child_atten = . if hh_child_atten==1 & no_missing_atten==0 /*If the household has been intially identified as non-deprived, but has missing school attendance for at least 2/3 of the school aged children, then we replace this household with a value of '.' because there is insufficient information to conclusively conclude that the household is not deprived */ lab var hh_child_atten "Household has all school age children up to class 8 in school" tab hh_child_atten, miss /*Note: The indicator takes value 1 if ALL children in school age are attending school and 0 if there is at least one child not attending. Households with no children receive a value of 1 as non-deprived. The indicator has a missing value only when there are all missing values on children attendance in households that have children in school age. */ ******************************************************************************** *** Step 2.3 Nutrition *** ******************************************************************************** ******************************************************************************** *** Step 2.3a Adult Nutrition *** ******************************************************************************** /*Note: Bolivia EDSA 2023 has anthropometric data for child 0-5 years, teen and adults 6-59 years */ /* Households are identified as having 'no eligible' members if there are no applicable population, that is, children 0-5 years, teen and adult women 6-59 years, or teen and adult men 6-59 years. These households will not have information on relevant indicators of health. As such, these households are considered as non-deprived in those relevant indicators.*/ ***Nutrition Eligiblity *No Eligible women 15-59 years for BMI ***************************************** gen fem_bmi = (hs01_0004a>=15 & hs01_0004a<=59 & gender==2) bys hh_id: egen hh_n_fem_bmi= sum(fem_bmi) //Number of eligible women for interview in the hh gen no_fem_bmi = (hh_n_fem_bmi==0) //Takes value 1 if the household had no eligible females for an interview lab var no_fem_bmi "Household has no eligible women for bmi" tab no_fem_bmi, miss ***No Eligible Women 5-59 years ***************************************** gen fem_nut = ((age_month_c>=60 & age_month_c<72 & gender==2) |(hs01_0004a>=6 & hs01_0004a<=59 & gender==2)) bys hh_id: egen hh_n_fem_nut = sum(fem_nut) //Number of eligible women for interview in the hh gen no_fem_nut = (hh_n_fem_nut==0) //Takes value 1 if the household had no eligible females for an interview lab var no_fem_nut "Household has no eligible women for nutrition" tab no_fem_nut, miss *Testing gen fem_nut_test = (age_month_c>=60 & age_month_c<72) bys hh_id: egen hh_n_fem_nut_test = sum(fem_nut_test) //Number of eligible women for interview in the hh gen no_fem_nut_test = (hh_n_fem_nut_test==0) //Takes value 1 if the household had no eligible females for an interview lab var no_fem_nut_test "Household has no eligible women for nutrition" tab no_fem_nut_test, miss *No Eligible men 15-59 years for BMI ***************************************** gen male_bmi = (hs01_0004a>=15 & hs01_0004a<=59 & gender==1) bys hh_id: egen hh_n_male_bmi= sum(male_bmi) //Number of eligible men for interview in the hh gen no_male_bmi = (hh_n_male_bmi==0) //Takes value 1 if the household had no eligible females for an interview lab var no_male_bmi "Household has no eligible men for bmi" tab no_male_bmi, miss *** No Eligible Men 5-59 years ***************************************** gen male_nut = ((age_month_c>=60 & age_month_c<72 & gender==1) |(hs01_0004a>=6 & hs01_0004a<=59 & gender==1)) bys hh_id: egen hh_n_male_nut = sum(male_nut) //Number of eligible men for interview in the hh gen no_male_nut = (hh_n_male_nut==0) //Takes value 1 if the household had no eligible males for an interview lab var no_male_nut "Household has no eligible man for nutrition" tab no_male_nut, miss *** No Eligible Women and Men aged 5-59 years ***************************************** gen no_adults_eligible_bmi=(no_fem_nut==1 & no_male_nut==1) lab var no_adults_eligible_bmi "Household has no eligible women or men aged 6-59 years" tab no_adults_eligible_bmi, miss *** No Eligible Children 0-5 years ***************************************** gen child_eligible = (age_monthsUnder5<60) tab child_eligible child_KR, m bys hh_id: egen hh_n_children_eligible = sum(child_eligible) //Number of eligible children for anthropometrics gen no_child_eligible = (hh_n_children_eligible==0) //Takes value 1 if there were no eligible children for anthropometrics lab var no_child_eligible "Household has no children eligible" tab no_child_eligible, miss *** No Eligible Women, Men or Children for nutrition *********************************************** /*NOTE: In the DHS datasets, we use this variable as a control variable for the nutrition indicator if nutrition data is present for children, women and men. */ gen no_eligibles_nut = (no_fem_nut==1 & no_male_nut==1 & no_child_eligible==1) lab var no_eligibles_nut "Household has no eligible women, men, or children for nutrition" tab no_eligibles_nut, miss drop child_eligible hh_n_children_eligible fem_bmi hh_n_fem_bmi male_bmi hh_n_male_bmi fem_nut hh_n_fem_nut male_nut hh_n_male_nut *** BMI Indicator for Women 15-59 years *** ******************************************************************* gen f_bmi = ha40 //Low BMI of women 15-59 years lab var f_bmi "Women's BMI" gen f_low_bmi = (f_bmi<18.5) replace f_low_bmi = . if f_bmi==. | f_bmi>=99.90 replace f_low_bmi = . if age>59 & age<. lab var f_low_bmi "BMI of women < 18.5" bysort hh_id: egen low_bmi = max(f_low_bmi) gen hh_no_low_bmi = (low_bmi==0) /*Under this section, households take a value of '1' if no women in the household has low bmi */ replace hh_no_low_bmi = . if low_bmi==. /*Under this section, households take a value of '.' if there is no information from eligible women*/ replace hh_no_low_bmi = 1 if no_fem_bmi==1 /*Under this section, households that don't have eligible female population are identified as non-deprived in nutrition. */ drop low_bmi lab var hh_no_low_bmi "Household has no adult women with low BMI" tab hh_no_low_bmi, miss /*Figures are exclusively based on information from eligible adult women (15-59 years) */ *** BMI Indicator for Men 15-59 years *** ******************************************************************* gen m_bmi = hb40 lab var m_bmi "Male's BMI" gen m_low_bmi = (m_bmi<18.5) replace m_low_bmi = . if m_bmi==. | m_bmi>=99.90 replace m_low_bmi = . if age>59 & age<. lab var m_low_bmi "BMI of male < 18.5" bysort hh_id: egen low_bmi = max(m_low_bmi) replace hh_no_low_bmi = 0 if low_bmi==1 /*Under this section, households take a value of '0' if there's any male with low bmi*/ replace hh_no_low_bmi = 1 if low_bmi==0 & hh_no_low_bmi==. /*Under this section, households take a value of '1' if no male has low BMI & info is missing for women */ drop low_bmi tab hh_no_low_bmi if subsample==1, miss /*Figures are based on information from eligible adult women and eligible men. For countries that do not have male recode or lack anthropometric data for men, then the figures are exclusively from women. */ *** BMI-for-age for individuals 5-19 years and BMI for individuals 20-59 years *** *********************************************************************************** replace age_months=age_month_b if age_month_b<. & age_months==. replace age_months=age_month_c if age_month_c<. & age_months==. replace low_bmiage=low_bmiage_b if low_bmiage_b<. & low_bmiage==. replace low_bmiage=low_bmiage_c if low_bmiage_c<. & low_bmiage==. gen low_bmi_byage = 0 lab var low_bmi_byage "Individuals with low BMI or BMI-for-age" replace low_bmi_byage = 1 if f_low_bmi==1 //Replace variable "low_bmi_byage = 1" if eligible women have low BMI /*Note: The following command will result in 0 changes when there is no BMI information from men*/ replace low_bmi_byage = 1 if low_bmi_byage==0 & m_low_bmi==1 //Replace variable "low_bmi_byage = 1" if eligible men have low BMI /*Note: The following command replaces BMI with BMI-for-age for those between the age group of 6-19 by their age in months where information is available */ //Replacement for boys and girls 5-19y: replace low_bmi_byage = 1 if low_bmiage==1 & age_months!=. & age>=5 & age<=19 replace low_bmi_byage = 0 if low_bmiage==0 & age_months!=. & age>=5 & age<=19 /*Note: The following control variable is applied when there is BMI information for women and men, as well as BMI-for-age for teenagers */ replace low_bmi_byage = . if f_low_bmi==. & m_low_bmi==. & low_bmiage==. bysort hh_id: egen low_bmi = max(low_bmi_byage) gen hh_no_low_bmiage = (low_bmi==0) /*Households take a value of '1' if all eligible adults and teenagers in the household has normal bmi or bmi-for-age */ replace hh_no_low_bmiage = . if low_bmi==. /*Households take a value of '.' if there is no information from eligible individuals in the household */ replace hh_no_low_bmiage = 1 if no_adults_eligible_bmi==1 *replace hh_no_low_bmiage = 1 if no_fem_nut==1 & no_male_nut==1 /*Households take a value of '1' if there is no eligible population (female and male aged 6-59 years.*/ drop low_bmi lab var hh_no_low_bmiage "Household has no adult with low BMI or BMI-for-age" tab hh_no_low_bmi if subsample==1, m tab hh_no_low_bmiage if subsample==1, m /*NOTE that hh_no_low_bmi takes value 1 if: (a) no any eligible adult in the household has (observed) low BMI or (b) there are no eligible adults in the household. One has to check and adjust the dofile so all people who are eligible and/or measured are included. It is particularly important to check if male are measured and what age group among males and females. The variable takes values 0 for those households that have at least one adult with observed low BMI. The variable has a missing value only when there is missing info on BMI for ALL eligible adults in the household */ ******************************************************************************** *** Step 2.3b Child Nutrition *** ******************************************************************************** *** Child Underweight Indicator *** ************************************************************************ bysort hh_id: egen temp = max(underweight) gen hh_no_underweight = (temp==0) //Takes value 1 if no child in the hh is underweight replace hh_no_underweight = . if temp==. replace hh_no_underweight = 1 if no_child_eligible==1 /* Households with no eligible children will receive a value of 1 */ lab var hh_no_underweight "Household has no child underweight - 2 stdev" drop temp *** Child Stunting Indicator *** ************************************************************************ bysort hh_id: egen temp = max(stunting) gen hh_no_stunting = (temp==0) //Takes value 1 if no child in the hh is stunted replace hh_no_stunting = . if temp==. replace hh_no_stunting = 1 if no_child_eligible==1 lab var hh_no_stunting "Household has no child stunted - 2 stdev" drop temp *** Child Either Stunted or Underweight Indicator *** ************************************************************************ gen uw_st = 1 if stunting==1 | underweight==1 *replace uw_st = 1 if low_bmiage==1 & age_months>=61 & age_months<=69 replace uw_st = 0 if stunting==0 & underweight==0 *replace uw_st = 0 if low_bmiage==0 & age_months>=61 & age_months<=69 replace uw_st = . if stunting==. & underweight==. bysort hh_id: egen temp = max(uw_st) gen hh_no_uw_st = (temp==0) //Takes value 1 if no child in the hh is underweight or stunted replace hh_no_uw_st = . if temp==. replace hh_no_uw_st = 1 if no_child_eligible==1 //Households with no eligible children will receive a value of 1 lab var hh_no_uw_st "Household has no child underweight or stunted" drop temp ******************************************************************************** *** Step 2.3c Household Nutrition Indicator *** ******************************************************************************** /* The indicator takes value 1 if there is no low BMI-for-age among teenagers, no low BMI among adults or no children under 5 underweight or stunted. It also takes value 1 for the households that have no eligible adult AND no eligible children. The indicator takes a value of missing "." only if all eligible adults and eligible children have missing information in their respective nutrition variable. */ gen hh_nutrition_uw_st = 1 if (hh_no_low_bmiage==1 & hh_no_uw_st==1) | (hh_no_low_bmiage==. & hh_no_uw_st==1 & no_child_eligible==0) | (hh_no_low_bmiage==1 & hh_no_uw_st==. & no_adults_eligible_bmi==0) replace hh_nutrition_uw_st = 0 if hh_no_low_bmiage==0 | hh_no_uw_st==0 replace hh_nutrition_uw_st = . if hh_no_low_bmiage==. & hh_no_uw_st==. replace hh_nutrition_uw_st = 1 if no_eligibles_nut==1 /*If country have collected anthropometric data from women, child 0-5 & a subsample of men, we only replace households which do not have any of these three applicable population as non-deprived*/ lab var hh_nutrition_uw_st "Household has no child underweight/stunted or adult deprived by BMI/BMI-for-age" tab hh_nutrition_uw_st, m ******************************************************************************** *** Step 2.4 Child Mortality *** ******************************************************************************** codebook ms02_0206 ms02_0207_1 ms02_0207_2 vs02_0206 vs02_0207_1 vs02_0207_2 //ms02_0207_1 or vs02_0207_1: number of sons who have died //ms02_0207_2 or vs02_0207_2: number of daughters who have died //Total child mortality reported by eligible women egen temp_f = rowtotal(ms02_0207_1 ms02_0207_2), missing replace temp_f = 0 if ms02_0206==2 bysort hh_id: egen child_mortality_f = sum(temp_f), missing lab var child_mortality_f "Occurrence of child mortality reported by women" tab child_mortality_f, miss drop temp_f //Total child mortality reported by eligible men egen temp_m = rowtotal(vs02_0207_1 vs02_0207_2), missing replace temp_m = 0 if vs02_0206==2 bysort hh_id: egen child_mortality_m = sum(temp_m), missing lab var child_mortality_m "Occurrence of child mortality reported by men" tab child_mortality_m, miss drop temp_m egen child_mortality = rowmax(child_mortality_f child_mortality_m) lab var child_mortality "Total child mortality within household reported by women & men" tab child_mortality if subsample==1, miss /*Deprived if any children died in the household in the last 5 years from the survey year */ ************************************************************************ gen test_temp=child_died_per_wom_5y tab child_died_per_wom_5y, miss /* The 'child_died_per_wom_5y' variable was constructed in Step 1.2 using information from individual women who ever gave birth in the BR file. The missing values represent eligible woman who have never ever given birth and so are not present in the BR file. But these 'missing women' may be living in households where there are other women with child mortality information from the BR file. So at this stage, it is important that we aggregate the information that was obtained from the BR file at the household level. This ensures that women who were not present in the BR file is assigned with a value, following the information provided by other women in the household.*/ replace child_died_per_wom_5y = 0 if ms02_0201==2 /*Assign a value of "0" for: - all eligible women who never ever gave birth */ replace child_died_per_wom_5y = 0 if no_fem_eligible==1 /*Assign a value of "0" for: - individuals living in households that have non-eligible women */ bysort hh_id: egen child_mortality_5y = sum(child_died_per_wom_5y), missing *replace child_mortality_5y = 0 if child_mortality_5y==. & child_mortality==0 replace child_mortality_5y = 0 if child_mortality_5y==. & child_mortality_m==0 /*Replace all households as 0 death if women has missing value and men reported no death in those households */ label var child_mortality_5y "Total child mortality within household past 5 years reported by women" tab child_mortality_5y if subsample==1, miss /* The new standard MPI indicator takes a value of "1" if eligible women within the household reported no child mortality or if any child died longer than 5 years from the survey year. The indicator takes a value of "0" if women in the household reported any child mortality in the last 5 years from the survey year. Households were replaced with a value of "1" if eligible men within the household reported no child mortality in the absence of information from women. The indicator takes a missing value if there was missing information on reported death from eligible individuals. */ gen hh_mortality_5y = (child_mortality_5y==0) replace hh_mortality_5y = . if child_mortality_5y==. tab hh_mortality_5y if subsample==1, miss lab var hh_mortality_5y "Household had no child mortality in the last 5 years" tab hh_mortality_5y, m ******************************************************************************** *** Step 2.5 Electricity *** ******************************************************************************** /*Members of the household are considered deprived if the household has no electricity */ gen electricity = 1 if hs04_0066==1 replace electricity=0 if hs04_0066==2 codebook electricity, tab (10) label var electricity "Household has electricity" ******************************************************************************** *** Step 2.6 Sanitation *** ******************************************************************************** /*Members of the household are considered deprived if the household's sanitation facility is not improved, according to MDG guidelines, or it is improved but shared with other household. In cases of mismatch between the MDG guideline and country report, we followed the country report. */ codebook hs04_0072 label var hs04_0072 "House has bathroom, toilet or latrine?" label var hs04_0073 "Type of bathroom, toilet or latrine do members normally use?" label def toilet 1"flushing toilet or latrine" 2"Cylinder pit latrine with floor" 3"Open pit latrine without floor" /// 4"Ecological toilet (dry or composting)", modify label values hs04_0073 toilet codebook hs04_0074 label var hs04_0074 "Does the bathroom, toilet or latrine have a drain?" label def drain 1"To the sewer system" 2"To a septic tank" 3"To a stop/absorption tanks" /// 4"To the surface street/stream/river" 5"Don't Know" label values hs04_0074 drain codebook hs04_0075 label var hs04_0075 "Is the toilet or latrine only used by HH member or shared?" //1=no;2=yes;.=missing clonevar shared_toilet = hs04_0075 clonevar toilet=hs04_0074 tab toilet hs04_0073, m gen toilet_mdg = 1 if toilet==1 | toilet==2 | toilet==5 | hs04_0073==2 | hs04_0073==4 *Cylinder pit latrine with floor and Ecological toilet/composting for variable "hs04_0073" categorized as "improved sanitation". *Need to check replace toilet_mdg = 0 if toilet==3 | toilet==4 | hs04_0073==3 *Open Pit Latrine without floor for variable "hs04_0073" categorized as "non-improved sanitation". *Need to check replace toilet_mdg = 0 if hs04_0072==2 *Household without toilet replace toilet_mdg = 0 if shared_toilet==2 *Household sharing toilet lab var toilet_mdg "Household has improved sanitation with MDG Standards" tab toilet toilet_mdg, miss ******************************************************************************** *** Step 2.7 Drinking Water *** ******************************************************************************** /*Members of the household are considered deprived if the household does not have access to safe drinking water according to MDG guidelines, or safe drinking water is more than a 30-minute walk from home roundtrip. In cases of mismatch between the MDG guideline and country report, we followed the country report.*/ codebook hs04_0067, tab(100) label def water 1"Pipe inside the home" 2"Piple outside the home but within lot" 3"Public pool" /// 4 "Rainwater harvesting" 5"Drilled or casesided well, with pump" 6"Covered dug well, with pump" /// 7" Covered dug well, no pump" 8"Uncovered dug well" 9"Protected spring or waterspring" 10"Unprotected rivere/ditch/waterspring" /// 11"Bottled water" 12 "Delivery car" 96 "Other", modify label values hs04_0067 water clonevar water = hs04_0067 clonevar timetowater = hs04_0068 codebook water, tab(100) gen water_mdg = 1 if water==1 | water==2 | water==3 | water==4 | water==5 | water==6 | water==7 | water==9 | water==11 | water==12 replace water_mdg = 0 if water==8 | water==10 | water==96 replace water_mdg = 0 if (water_mdg==1 | water_mdg==.) & timetowater >= 30 & timetowater<=180 //Deprived if water is at more than 30 minutes' walk (roundtrip) lab var water_mdg "Household has drinking water with MDG standards (considering distance)" tab water water_mdg, miss ******************************************************************************** *** Step 2.8 Housing *** ******************************************************************************** /* Members of the household are considered deprived if the household has a dirt, sand or dung floor */ clonevar floor = hs04_0065 codebook floor, tab(99) gen floor_imp = 1 replace floor_imp = 0 if floor==1 | floor==96 //Deprived if "mud/earth", "sand", "dung", "other" replace floor_imp = . if floor==. | floor==999 lab var floor_imp "Household has floor that it is not earth/sand/dung" tab floor floor_imp, miss /* Members of the household are considered deprived if the household has wall made of natural or rudimentary materials */ clonevar wall = hs04_0062 codebook wall, tab(99) gen wall_imp = 1 replace wall_imp = 0 if wall==3 | wall==4 | wall==5 | wall==6 | wall==96 /*Deprived if "no wall" "cane/palms/trunk" "mud/dirt" "grass/reeds/thatch" "pole/bamboo with mud" "stone with mud" "plywood" "cardboard" "carton/plastic" "uncovered adobe" "canvas/tent" "unburnt bricks" "reused wood" "other"*/ replace wall_imp = . if wall==. | wall==999 lab var wall_imp "Household has wall that it is not of low quality materials" tab wall wall_imp, miss /* Members of the household are considered deprived if the household has roof made of natural or rudimentary materials */ clonevar roof = hs04_0064 codebook roof, tab(99) gen roof_imp = 1 replace roof_imp = 0 if roof==4 | roof==96 /*Deprived if "no roof" "thatch/palm leaf" "mud/earth/lump of earth" "sod/grass" "plastic/polythene sheeting" "rustic mat" "cardboard" "canvas/tent" "wood planks/reused wood" "unburnt bricks" "other"*/ replace roof_imp = . if roof==. | roof==99 lab var roof_imp "Household has roof that it is not of low quality materials" tab roof roof_imp, miss /*Household is deprived in housing if the roof, floor OR walls uses low quality materials.*/ gen housing_1 = 1 replace housing_1 = 0 if floor_imp==0 | wall_imp==0 | roof_imp==0 replace housing_1 = . if floor_imp==. & wall_imp==. & roof_imp==. lab var housing_1 "Household has roof, floor & walls that it is not low quality material" tab housing_1, miss ******************************************************************************** *** Step 2.9 Cooking Fuel *** ******************************************************************************** /* Members of the household are considered deprived if the household cooks with solid fuels: wood, charcoal, crop residues or dung. "Indicators for Monitoring the Millennium Development Goals", p. 63 */ clonevar cookingfuel = hs04_0076 codebook cookingfuel, tab(99) gen cooking_mdg = 1 if (cookingfuel>=3 & cookingfuel<=6) | cookingfuel==96 *"Other fuel" coded as non-deprived. replace cooking_mdg = 0 if cookingfuel==1 | cookingfuel==2 replace cooking_mdg = . if cookingfuel==. | cookingfuel==99 lab var cooking_mdg "Househod has cooking fuel according to MDG standards" tab cookingfuel cooking_mdg, miss ******************************************************************************** *** Step 2.10 Assets ownership *** ******************************************************************************** /* Members of the household are considered deprived if the household does not own more than one of: radio, TV, telephone, bike, motorbike or refrigerator and does not own a car or truck. */ //Check that for standard assets in living standards: "no"==0 and yes=="1" codebook hs04_0081_02 hs04_0081_01 hs04_0081_10 hs04_0081_11 hs04_0081_04 hs04_0081_16 hs04_0081_14 hs04_0081_15 hs04_0081_06 clonevar television = hs04_0081_02 gen bw_television = . clonevar radio = hs04_0081_01 clonevar telephone = hs04_0081_10 clonevar mobiletelephone = hs04_0081_11 clonevar refrigerator = hs04_0081_04 clonevar car = hs04_0081_16 clonevar bicycle = hs04_0081_14 clonevar motorbike = hs04_0081_15 clonevar computer = hs04_0081_06 gen animal_cart = . * animal cart not available * foreach var in television radio telephone mobiletelephone refrigerator car bicycle motorbike computer animal_cart { replace `var' = . if `var'==9 | `var'==999 | `var'==8 | `var'==98 replace `var' = 0 if `var'==2 } //9 , 999 and 8, 98 are missing values //Group telephone and mobiletelephone as a single variable replace telephone=1 if (telephone==0 | telephone==.) & mobiletelephone==1 /* Members of the household are considered deprived in assets if the household does not own more than one of: radio, TV, telephone, bike, motorbike, refrigerator, computer or animal_cart and does not own a car or truck.*/ egen n_small_assets2 = rowtotal(television radio telephone refrigerator bicycle motorbike computer animal_cart), missing lab var n_small_assets2 "Household Number of Small Assets Owned" gen hh_assets2 = (car==1 | n_small_assets2 > 1) replace hh_assets2 = . if car==. & n_small_assets2==. lab var hh_assets2 "Household Asset Ownership: HH has car or more than 1 small assets incl computer & animal cart" ******************************************************************************** *** Step 2.11 Rename and keep variables for MPI calculation ******************************************************************************** //Retain data on sampling design: *desc hv022 hv021 clonevar strata = estrato clonevar psu = upm //Retain year, month & date of interview: clonevar year_interview = hs01_0101_1c clonevar month_interview = hs01_0101_1b clonevar date_interview = hs01_0101_1a *** Rename key global MPI indicators for estimation *** recode hh_mortality_5y (0=1)(1=0) , gen(d_cm) recode hh_nutrition_uw_st (0=1)(1=0) , gen(d_nutr) recode hh_child_atten (0=1)(1=0) , gen(d_satt) recode hh_years_edu6 (0=1)(1=0) , gen(d_educ) recode electricity (0=1)(1=0) , gen(d_elct) recode water_mdg (0=1)(1=0) , gen(d_wtr) recode toilet_mdg (0=1)(1=0) , gen(d_sani) recode housing_1 (0=1)(1=0) , gen(d_hsg) recode cooking_mdg (0=1)(1=0) , gen(d_ckfl) recode hh_assets2 (0=1)(1=0) , gen(d_asst) *** Keep selected variables for global MPI estimation *** keep hh_id ind_id ccty cty survey year subsample strata psu weight area relationship sex age agec7 agec4 /*marital*/ hhsize region year_interview month_interview date_interview d_cm d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst hh_mortality_5y hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 order hh_id ind_id ccty cty survey year subsample strata psu weight area relationship sex age agec7 agec4 /*marital*/ hhsize region year_interview month_interview date_interview d_cm d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst hh_mortality_5y hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 *** Sort, compress and save data for estimation *** sort ind_id compress save "$path_out/bol_edsa23_pov.dta", replace log close ******************************************************************************** *** MPI Calculation (TTD file) ******************************************************************************** **SELECT COUNTRY POV FILE RUN ON LOOP FOR MORE COUNTRIES use "$path_out\bol_edsa23_pov.dta", clear ******************************************************************************** *** Define Sample Weight and total population *** ******************************************************************************** gen sample_weight = weight gen country = "Bolivia" gen countrycode = "BOL" ******************************************************************************** *** List of the 10 indicators included in the MPI *** ******************************************************************************** gen edu_1 = hh_years_edu6 gen atten_1 = hh_child_atten gen cm_1 = hh_mortality_5y /* change countries with no child mortality 5 year to child mortality ever*/ gen nutri_1 = hh_nutrition_uw_st gen elec_1 = electricity gen toilet_1 = toilet_mdg gen water_1 = water_mdg gen house_1 = housing_1 gen fuel_1 = cooking_mdg gen asset_1 = hh_assets2 global est_1 edu_1 atten_1 cm_1 nutri_1 elec_1 toilet_1 water_1 house_1 fuel_1 asset_1 ******************************************************************************** *** List of sample without missing values *** ******************************************************************************** foreach j of numlist 1 { gen sample_`j' = (edu_`j'!=. & atten_`j'!=. & cm_`j'!=. & nutri_`j'!=. & elec_`j'!=. & toilet_`j'!=. & water_`j'!=. & house_`j'!=. & fuel_`j'!=. & asset_`j'!=.) replace sample_`j' = . if subsample==0 /* Note: If the anthropometric data was collected from a subsample of the total population that was sampled, then the final analysis only includes the subsample population. */ *** Percentage sample after dropping missing values *** sum sample_`j' [iw = sample_weight] gen per_sample_weighted_`j' = r(mean) sum sample_`j' gen per_sample_`j' = r(mean) } *** ******************************************************************************** *** Define deprivation matrix 'g0' *** which takes values 1 if individual is deprived in the particular *** indicator according to deprivation cutoff z as defined during step 2 *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen g0`j'_`var' = 1 if `var'==0 replace g0`j'_`var' = 0 if `var'==1 } } *** Raw Headcount Ratios foreach j of numlist 1 { foreach var in ${est_`j'} { sum g0`j'_`var' if sample_`j'==1 [iw = sample_weight] gen raw`j'_`var' = r(mean)*100 lab var raw`j'_`var' "Raw Headcount: Percentage of people who are deprived in `var'" } } ******************************************************************************** *** Define vector 'w' of dimensional and indicator weight *** ******************************************************************************** /*If survey lacks one or more indicators, weights need to be adjusted within / each dimension such that each dimension weighs 1/3 and the indicator weights add up to one (100%). CHECK COUNTRY FILE*/ foreach j of numlist 1 { // DIMENSION EDUCATION foreach var in edu_`j' atten_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/6 } // DIMENSION HEALTH foreach var in cm_`j' nutri_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/6 } // DIMENSION LIVING STANDARD foreach var in elec_`j' toilet_`j' water_`j' house_`j' fuel_`j' asset_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/18 } } ******************************************************************************** *** Generate the weighted deprivation matrix 'w' * 'g0' ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen w`j'_g0_`var' = w`j'_`var' * g0`j'_`var' replace w`j'_g0_`var' = . if sample_`j'!=1 /*The estimation is based only on observations that have non-missing values for all variables in varlist_pov*/ } } ******************************************************************************** *** Generate the vector of individual weighted deprivation count 'c' ******************************************************************************** foreach j of numlist 1 { egen c_vector_`j' = rowtotal(w`j'_g0_*) replace c_vector_`j' = . if sample_`j'!=1 *drop w_g0_* } ******************************************************************************** *** Identification step according to poverty cutoff k (20 33.33 50) *** ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { gen multidimensionally_poor_`j'_`k' = (c_vector_`j'>=`k'/100) replace multidimensionally_poor_`j'_`k' = . if sample_`j'!=1 //Takes value 1 if individual is multidimensional poor } } ******************************************************************************** *** Generate the censored vector of individual weighted deprivation count 'c(k)' ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { gen c_censured_vector_`j'_`k' = c_vector_`j' replace c_censured_vector_`j'_`k' = 0 if multidimensionally_poor_`j'_`k'==0 } //Provide a score of zero if a person is not poor } * ******************************************************************************** *** Define censored deprivation matrix 'g0(k)' *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen g0`j'_k_`var' = g0`j'_`var' replace g0`j'_k_`var' = 0 if multidimensionally_poor_`j'_33==0 replace g0`j'_k_`var' = . if sample_`j'!=1 } } ******************************************************************************** *** Generates Multidimensional Poverty Index (MPI), *** Headcount (H) and Intensity of Poverty (A) *** ******************************************************************************** *** Multidimensional Poverty Index (MPI) *** foreach j of numlist 1 { foreach k of numlist 20 33 50 { sum c_censured_vector_`j'_`k' [iw = sample_weight] if sample_`j'==1 gen MPI_`j'_`k' = r(mean) lab var MPI_`j'_`k' "MPI with k=`k'" } sum c_censured_vector_`j'_33 [iw = sample_weight] if sample_`j'==1 gen MPI_`j' = r(mean) lab var MPI_`j' "`j' Multidimensional Poverty Index (MPI = H*A): Range 0 to 1" *** Headcount (H) *** sum multidimensionally_poor_`j'_33 [iw = sample_weight] if sample_`j'==1 gen H_`j' = r(mean)*100 lab var H_`j' "`j' Headcount ratio: % Population in multidimensional poverty (H)" *** Intensity of Poverty (A) *** sum c_censured_vector_`j'_33 [iw = sample_weight] if multidimensionally_poor_`j'_33==1 & sample_`j'==1 gen A_`j' = r(mean)*100 lab var A_`j' "`j' Intensity of deprivation among the poor (A): Average % of weighted deprivations" *** Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations) *** gen temp = 0 replace temp = 1 if c_vector_`j'>=0.2 & c_vector_`j'<0.3332 replace temp = . if sample_`j'!=1 sum temp [iw = sample_weight] gen vulnerable_`j' = r(mean)*100 lab var vulnerable_`j' "`j' % Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations)" drop temp *** Population in severe poverty (with intensity 50% or higher) *** gen temp = 0 replace temp = 1 if c_vector_`j'>0.49 replace temp = . if sample_`j'!=1 sum temp [iw = sample_weight] gen severe_`j' = r(mean)*100 lab var severe_`j' "`j' % Population in severe poverty (with intensity 50% or higher)" drop temp } * *** Censored Headcount *** foreach j of numlist 1 { foreach var in ${est_`j'} { sum g0`j'_k_`var' [iw = sample_weight] if sample_`j'==1 gen cen`j'_`var' = r(mean)*100 lab var cen`j'_`var' "Censored Headcount: Percentage of people who are poor and deprived in `var'" } } *** Dimensional Contribution *** foreach j of numlist 1 { foreach var in ${est_`j'} { gen cont`j'_`var' = (w`j'_`var' * cen`j'_`var')/MPI_`j' if sample_`j'==1 lab var cont`j'_`var' "% Contribution in MPI of indicator..." } } ** The line below produces the variance (inequality among the poor) ** sum c_vector_1 if c_vector_1>=1/3 & c_vector_1<=1 [aw = sample_weight], detail gen var=r(Var) *** Prepare results to export *** order hh_id ind_id ccty cty survey year subsample strata psu weight area relationship sex age agec7 agec4 /*marital*/ hhsize region year_interview month_interview date_interview MPI_1 H_1 A_1 severe_1 vulnerable_1 var cont1_nutr cont1_cm_1 cont1_edu_1 cont1_atten_1 cont1_fuel_1 cont1_toilet_1 cont1_water_1 cont1_elec_1 cont1_house_1 cont1_asset_1 per_sample_1 per_sample_weighted_1 raw1_nutri_1 raw1_cm_1 raw1_edu_1 raw1_atten_1 raw1_fuel_1 raw1_toilet_1 raw1_water_1 raw1_elec_1 raw1_house_1 raw1_asset_1 cen1_nutri_1 cen1_cm_1 cen1_edu_1 cen1_atten_1 cen1_fuel_1 cen1_toilet_1 cen1_water_1 cen1_elec_1 cen1_house_1 cen1_asset_1 save "Bolivia_EDSA23_MPI2025.dta", replace codebook, compact clear