*********************************************************************************************************************** ** 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\Mexico_2023\Mexico_StataDatasets" global path_out "C:\UNDP\MPI\MPI_Computation\MPI_2025\National\Mexico_2023\Outputs" global path_logs "C:\UNDP\MPI\MPI_Computation\MPI_2025\National\Mexico_2023" global path_qc "C:\UNDP\MPI\MPI_Computation\MPI_2025\National\Mexico_2023" global path_ado "C:" *** Log file *** log using "$path_logs/Mexico_national23_dataprep.log", replace ******************************************************************************** *** Mexico ENSAUT Survey 2023 *** ******************************************************************************** ******************************************************************************** *** Step 1.1 NUTRITION DATA ******************************************************************************** *Preparing the anthropometric dataset******* /*Mexico ENSANUT survey collected anthropometric measurements (weight and height) from 0-5 years, young children and adults. However, only one person was selected for measurement from age group 5-9 years and 10-19 years; and a 0.8 probability of selection was applied to those between 20-99+ years, and the selection was independent of sex. For the Mexico ENSANUT survey, we decided to use under-five children nutrition information since all under-five children were eligible for measurement, and the non-response rate is also low. */ use "$path_in/Antropometria_HTA_4mar24.dta", clear *** Household unique id gen hh_id = FOLIO_I lab var hh_id "Household ID" *** Individual unique id gen ind_id = FOLIO_INT label var ind_id "Individual ID" duplicates report hh_id duplicates report ind_id *** Variable: SEX *** lookfor sex codebook h0302 //"1" for male ;"2" for female clonevar gender = h0302 desc gender tab gender h0302, m *** Variable: AGE *** *Spliting the "date of birth" variable into seperate variables: birth_day, birth_month, birth_year variables. lookfor edad //edad = age in years gen day_st=substr(fech_nac, 1, 2) gen month_st=substr(fech_nac, 3, 2) gen year_st=substr(fech_nac, 5, 4) destring day_st, gen(daydob) destring month_st, gen (monthdob) destring year_st, gen (yeardob) /*Date of birth variable contains some irrelevant values. Recoding birth year and month as missing for incorrect values. Recoding birth day as "15" for values greater than "31" */ *Constructing date of birth from the birth day, month and year variable tab1 daydob monthdob yeardob, miss *Recoding irrelevant birth-year as missing replace yeardob=. if yeardob==9999 replace monthdob=. if monthdob==99 replace daydob=. if daydob==99 //Recoding irrelevant birth-month variable as 6 //Recoding irrelevant birth-day variable as 15 *replace month_st="6" if month_st>"12" replace daydob=15 if daydob>31 & monthdob<=12 & yeardob<9999 replace monthdob=6 if monthdob>12 & daydob<=31 & yeardob<9999 gen bdate=mdy(monthdob, daydob, yeardob) format bdate %td //Constructing date of birth from dataset dob variable gen bdate1 = date(fech_nac, "DMY") // birth date format bdate1 %td *browse bdate1 bdate fech_nac if bdate1!=bdate compare bdate bdate1 //More missing values for "fech_nac" variable, so we will use "bdate" for further computation. drop bdate1 //Constructing measurement date gen mdate=date(fecha_fin, "DMY") //Calculate birth date in days from date of interview gen age_months = (mdate-bdate)/30.4375 replace age_months = h0303*12 if (age_months<0 | age_months==.) /*replace age_months=int(age_months)*/ sum age_months label variable age_months "Age in months" sum age_months gen str6 ageunit = "months" lab var ageunit "Months" *** BODY WEIGHT (KILOGRAMS) for under 60 years of age *** *Two measurements of weight and height were recorded per individual, we average the measurements for further computation codebook an01_1, tab(9999) /*first measurement*/ codebook an01_2, tab (9999)/*second measurement*/ compare an01_1 an01_2 //Difference between two measurements within +/- 0.39 kilograms **recoding problematic measurements replace an01_1=. if an01_1>222 replace an01_2=. if an01_2>222 //222.22=person weight not measured compare an01_1 an01_2 *For n=14 samples, only an01_2 is missing. browse an01_1 an01_2 if an01_2==. & an01_1!=. **Taking average of two measurements egen weight=rmean(an01_1 an01_2) sum weight browse an01_1 an01_2 weight if an01_2==. & an01_1!=. lookfor an03 tab an03, miss //an03 = result of weight measurement label define lab_weight 1 "without problem" 2 "physical problem" 3 "didn't cooperate" 4 "refused" /// 5" not found" 6"Can't stand up", modify label values an03 lab_weight tab an03 weight if weight>=222 | weight==., miss //60 missing values for weight explained desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) for under 60 years of age *Two height measurements were recorded per individual, we only consider the first measurement codebook an04_1, tab(9999) /*first measurement*/ codebook an04_2, tab (9999) /*second measurement*/ compare an04_1 an04_2 //Difference between two height measurements within +/- 1 cm *recoding problematic measurements replace an04_1=. if an04_1>222 replace an04_2=. if an04_2>222 //222.22=person height not measured **Taking average of two measurements egen height = rmean(an04_1 an04_2) lookfor an05 tab an05, miss //an05 = result of height measurement label define lab_height 1 "without problem" 2 "physical problem" 3"didn't cooperate" 4 "refused" /// 5 "not found" 6"Can't stand up", modify label values an05 lab_height tab an05 if height>=222 | height==., m //79 missing values for height explained desc height summ height *** Variable: MEASURED STANDING/LYING DOWN *** /*No information available on how the measurements were taken (standing up or lying down) Survey questionnaire specify the measurement as "length" for under 24 months and "size". Assuming the measurements taken for less than 24 months as "lying" and =>24 months as "standing up".*/ gen measure = "l" if age_months<24 //Child measured lying down replace measure = "h" if age_months>=24 & age_months!=. //Child measured standing up replace measure = "" if height==. //Replace with " " if unknown desc measure tab measure, m *** Variable: OEDEMA *** lookfor oedema gen str1 oedema = "n" //It assumes no-one has oedema desc oedema tab oedema *** Variable: INDIVIDUAL CHILD SAMPLING WEIGHT *** lookfor ponde gen sw = ponde_f desc sw summ sw /*Save file in order to use the .dta file to compute nutrition indicators individually for children under 5, teenagers, and adults */ save "$path_out/Mexico22_anthropometric.dta", replace count //9404 observations ****************************************************************************** *** Step 1.1a Nutrition indicators for children under 5 ******************************************************************************** use "$path_out/Mexico22_anthropometric.dta", clear sort ind_id *Need to be less than 60 month gen child_KR=1 if age_month<60 * 1,002 children under 5y //Generate identification variable for observations in KR recode keep if child_KR==1 //Retain observations of those children aged 60 months & younger tab age_month, miss *** 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_mexico" lab var datalab "Working file" /*We now run the command to calculate the z-scores with the adofile */ igrowup_restricted reflib datalib datalab gender age_month 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_Mexico_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 count if _fwei==1 | _flen==1 /*Note: In Mexico ENSANUT 2023, 8 children were replaced as missing because they have extreme z-scores which are biologically implausible. */ //Retain relevant variables: keep FOLIO_I FOLIO_INT hh_id ind_id child_KR age_months underweight stunting wasting gender ponde_f order FOLIO_I FOLIO_INT hh_id ind_id child_KR age_months underweight stunting wasting gender ponde_f sort FOLIO_I FOLIO_INT duplicates report FOLIO_I FOLIO_INT //Erase files from folder: erase "$path_out/children_nutri_Mexico_z_rc.xls" erase "$path_out/children_nutri_Mexico_prev_rc.xls" *erase "$path_out/children_nutri_Mexico_z_rc.dta" //Save a temp file for merging with PR: save "$path_out/Mexico22_KR.dta", replace ******************************************************************************** *** Step 1.1b BMI-for-age for individuals above 5 and 19 years ******************************************************************************** ******************************************************************************** *** Step 1.3 HOUSEHOLD RECODE ******************************************************************************** use "$path_in/hogar_ensanut2023_w_n.dta", clear *** Generate a household unique key variable at the household level using: gen hh_weight=ponde_f sort FOLIO_I save "$path_out/mexico22_hh.dta", replace ******************************************************************************** *** Step 1.4 HOUSEHOLD MEMBER RECODE ******************************************************************************** use "$path_in/integrantes_ensanut2023_w_n.dta", clear gen country = "Mexico" gen countrycode = "MEX" gen year = "2023" gen survey = "National" *** Household unique id gen hh_id = FOLIO_I lab var hh_id "Household ID" *** Individual unique id gen ind_id = FOLIO_INT label var ind_id "Individual ID" duplicates report hh_id duplicates report ind_id sort FOLIO_I FOLIO_INT ******************************************************************************** *** Step 1.5 DATA MERGING ******************************************************************************** merge m:1 FOLIO_I using "$path_out/mexico22_hh.dta" // 36483 observations matched (100%) drop _merge erase "$path_out/mexico22_hh.dta" *** Merging nutrition data *************************************************** merge 1:1 FOLIO_I FOLIO_INT using "$path_out/Mexico22_KR.dta", force // drop _merge erase "$path_out/Mexico22_anthropometric.dta" erase "$path_out/Mexico22_KR.dta" *erase "$path_out/Mexico22_nutrition.dta" *erase "$path_out/MEX22_NUTRI.dta" /* *** Merging adult nutrition data *************************************************** merge 1:1 FOLIO_I FOLIO_INT using "$path_out/Mexico22_nutrition.dta", force drop _merge erase "$path_out/Mexico22_nutrition.dta" */ *** Merging child mortality data *************************************************** /* merge 1:1 FOLIO_I FOLIO_INT using "$path_out/Mexico22_CM.dta" //6073 observations matched drop _merge erase "$path_out/Mexico22_CM.dta" erase "$path_out/Mexico22_ChdMor_teen.dta" */ ******************************************************************************** *** 1.6 RENAMING DEMOGRAPHIC VARIABLES *** ******************************************************************************** //Sample weight lookfor weight //"ponde_f" as the household member weight clonevar weight=ponde_f label var weight "Individual sample weight" //Area: Urban or rural lookfor urban //"estrato" variable named as the urban/rural stratum: 1-Rural, 2-Urbano and 3-Metropolitano clonevar area=estrato codebook area replace area=0 if area==1 replace area=1 if area==2| area==3 label define lab_area 1 "urban" 0 "rural" label values area lab_area label var area "Area: urban-rural" tab area estrato, miss //Sex of household member lookfor sex //"h0302" as the gender variable: 1- Hombre (Man) and 2-Mujer (Women) clonevar sex=h0302 label define sex 1"Male" 2"Female" label values sex sex label var sex "Sex of household member" tab sex, m //Age of household member lookfor age //"h0303" as the age varaible clonevar age=h0303 tab age, m replace age=. if age>900 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)" //Marital status of household member /*"h0319" as the marrital status variable. Variable codes/options translated (google) as 1-Live with your partner in free union, 2-Seperated from free union, 3-Is seperated from a marriage, 4-Is divorced, 5-Widow(or), 6-Are you married civilly or religiously, and 7-Single. */ clonevar marital = h0319 codebook marital, tab (20) recode marital (1=1)(7=1)(6=2)(5=3) (4=4) (2=5) (3=5) label define lab_mar 1"never married" 2"currently married" /// 3"widowed" 4"divorced" 5"not living together" label values marital lab_mar label var marital "Marital status of household member" tab h0319 marital, miss //Total number of de jure hh members in the household *Assuming that there is no "de jure" identifier variable in the dataset. = gen member = 1 bysort hh_id: egen hhsize = sum(member) label var hhsize "Household size" tab hhsize, miss drop member compare hhsize h0204 //Subnational region lookfor region tab x_region, miss clonevar region=x_region lab var region "Region for subnational decomposition" ******************************************************************************** *** Step 1.7 CONTROL VARIABLES ******************************************************************************** /* Households are identified as having 'no eligible' members for nutrition indicator if there are no applicable population, that is, children 0-4 years. As such, these households are considered as non-deprived in those relevant indicators. *The Mexico datasets do not contain eligibility criteria variables, so we will construct eligibility variable based on the participant's age */ desc h0304d h0304m h0304a gen bm = h0304m if h0304m<99 gen bd = h0304d if h0304d<99 gen by = h0304a if h0304a<9999 gen bdate1 = mdy(bm, bd, by) replace bdate1 = mdy(bm, 15 , by) if h0304d>31 format bdate1 %td su bdate1 gen mdate1 = date(fecha_fin, "DMY") // interview date format mdate1 %td su mdate1 gen age_month_all = (mdate1-bdate1)/30.4375 // age in months replace age_month_all = h0303*12 /*+meses*/ if age_month_all==. & h0303<999 lab var age_month_all "age in months" su age_month_all *** No eligible children 0-4 years **************************************** gen child_eligible = (age_month_all>=0 & age_month_all<60) 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 aged 0-4 years eligible" tab no_child_eligible, miss sort FOLIO_I FOLIO_INT ******************************************************************************** *** Step 2 Data preparation *** *** Standardization of the 10 Global MPI indicators *** Identification of non-deprived & deprived individuals ******************************************************************************** ******************************************************************************** *** Step 2.1 Years of Schooling *** ******************************************************************************** ** official entrance age = 6 yrs ** duration of primary = 6 yrs /*Official entrace age lower and upper secondary level: 12 and 15 years respectively.*/ clonevar edulevel=h0317a label define edulevel 0"None" 1"Preschool" 2"Primary" 3"Secondary" 4" High School" /// 5"Basic standard" 6"Technical studies or business with primary" 7"Technical studies or busines with secondary" /// 8"technical studies or commericial with high School" 9"Undergraduate course" 10"Bachelor or professional" /// 11"Master degree" 12"Doctorate", modify label values edulevel edulevel clonevar grade=h0317g tab grade edulevel, miss gen eduyears=0 if edulevel==0| edulevel==1 replace eduyears=1 if (edulevel==2 | edulevel==5) & grade==1 replace eduyears=2 if (edulevel==2 | edulevel==5) & grade==2 replace eduyears=3 if (edulevel==2 | edulevel==5) & grade==3 replace eduyears=4 if (edulevel==2 | edulevel==5) & grade==4 replace eduyears=5 if (edulevel==2 | edulevel==5) & grade==5 replace eduyears=6 if (edulevel==2 | edulevel==5) & grade==6 //We assume basic standard education as primary replace eduyears=7 if (edulevel==3| edulevel==6) & grade==1 replace eduyears=8 if (edulevel==3| edulevel==6) & grade==2 replace eduyears=9 if (edulevel==3| edulevel==6) & grade==3 replace eduyears=10 if (edulevel==4|edulevel==7) & grade==1 replace eduyears=11 if (edulevel==4|edulevel==7) & grade==2 replace eduyears=12 if (edulevel==4|edulevel==7) & grade==3 replace eduyears=13 if (edulevel==8|edulevel==9| edulevel==10) & grade==1 replace eduyears=14 if (edulevel==8|edulevel==9| edulevel==10) & grade==2 replace eduyears=15 if (edulevel==8|edulevel==9| edulevel==10) & grade==3 replace eduyears=16 if (edulevel==8|edulevel==9| edulevel==10) & grade==4 replace eduyears=17 if (edulevel==8|edulevel==9| edulevel==10) & (grade==5 | grade==6) replace eduyears=18 if edulevel==11 & grade==1 replace eduyears=19 if edulevel==11 & grade==2 replace eduyears=20 if edulevel==11 & (grade==3|grade==4|grade==5|grade==6) replace eduyears=21 if edulevel==12 & (grade==1| grade==2|grade==3|grade==4|grade==5|grade==6) //We assign maximum education year as 21 years. /* Check eduyears for those who can't read and write tab eduyears if h0318==2 replace eduyears=0 if eduyears!=. & h0318==2 //Assigning eduyears as zero for those who can't read and write. . */ lab var eduyears "Highest year of education completed" *** Cleaning inconsistencies replace eduyears = . if age<=eduyears & age>0 /*There are cases in which the years of schooling are greater than the age of the individual. This is clearly a mistake in the data. Please check whether this is the case and correct when necessary */ replace eduyears = 0 if age < 10 /*The variable "eduyears" was replaced with a '0' given that the criteria for this indicator is household member aged 10 years or older */ replace eduyears = 0 if (age==10 | age==11) & eduyears < 6 /*The variable "eduyears" was replaced with a '0' given that the criteria for this indicator is household member aged 12 years or older */ /*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" tab hh_years_edu6, m ******************************************************************************** *** Step 2.2 Child School Attendance *** ******************************************************************************** codebook h0313, tab (10) gen attendance = 1 if h0313==1 //Replace attendance with '1' if currently attending school replace attendance = 0 if h0313==2 //Replace attendance with '0' if currently not attending school replace attendance = 0 if age<5 | age>24 //Replace attendance with '0' for individuals who are not of school age label define lab_attend 1 "currently attending" 0 "not currently attending" label values attendance lab_attend label var attendance "Attended school during current school year" tab attendance h0313, m *** Standard MPI *** ******************************************************************* /*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 Mexico, the official school entrance age is 6 years. So, age range is 6-14 (=6+8). Source: "http://data.uis.unesco.org/?ReportId=163" Go to Education>Education>System>Official entrance age to primary education. Look at the starting age and add 8. */ /*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==. /*All school aged children had information on school attendance but we proceed with generating following variables to make it consistent with MPI computation */ gen temp = 1 if child_schoolage==1 & attendance!=. 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 *** ******************************************************************************** *** Child Either Stunted or Underweight Indicator *** ************************************************************************ tab stunting if age_month_all>=0 & age_month_all<60, m //Child's stunting and underweight info missing for 25.3% of eligible under five children. tab underweight if age_month_all>=0 & age_month_all<60, m tab stunting if child_KR==1, m gen uw_st = 1 if stunting==1 | underweight==1 replace uw_st = 0 if stunting==0 & underweight==0 replace uw_st = . if stunting==. & underweight==. tab uw_st if child_KR==1, m /*The Mexico_ENSANUT2023 survey included all pre-school children aged 0-4 years, but only one individual per household for school aged children (5-9 years), teenagers (10-19 years), adults (20-44 years), and adults 45+ years. There is no specific variable that identify individuals selected for interview aged over 4 years. Thus, we can only generate eligiblity variable based on the individual's age, which is not accurate approach and explains the reason for relatively high missing values for anthropometric data. Thus, at this stage, we will proceed with only including anthropometric data from child aged less than 5 years. */ ******************************************************************************** *** Step 2.3a Household Nutrition Indicator *** ******************************************************************************** gen nutritiondef=1 if uw_st==1 replace nutritiondef=0 if uw_st==0 tab nutritiondef, miss /* replace nutritiondef=1 if low_bmi_teen==1 & nutritiondef==. replace nutritiondef=0 if low_bmi_teen==0 & nutritiondef==. tab nutritiondef, miss replace nutritiondef=1 if adult_low_bmi==1 &nutritiondef==. replace nutritiondef=0 if adult_low_bmi==0 &nutritiondef==. tab nutritiondef, miss */ bysort hh_id: egen temp = max(nutritiondef) gen hh_nutrition_uw_st = (temp==0) //Takes value 1 if no child in the household is underweight or stunted or no teen age with low-bmi-age or no adult with low bmi replace hh_nutrition_uw_st = . if temp==. replace hh_nutrition_uw_st = 1 if no_child_eligible==1 //Households with no eligible individuals for nutrition information will receive a value of 1 lab var hh_nutrition_uw_st "Household has no underweight or stunted child or low-bmi-age teen or low bmi adult" drop temp tab hh_nutrition_uw_st, m ******************************************************************************** *** Step 2.4 Household Child Mortality Indicator *** ******************************************************************************** ******************************************************************************** *** Step 2.5 Electricity *** ******************************************************************************** /*Members of the household are considered deprived if the household has no electricity */ lookfor electricity eléctrica gen electricity= h0111 codebook electricity, tab (10) recode electricity (2=0) (1=1) label var electricity "Household has electricity" tab electricity, miss ******************************************************************************** *** Step 2.6 Sanitation *** ******************************************************************************** /*It seems the survey has only collected information about the drainage rathar than the type of sanitation/toilets. * Report presents avialability of the drainage in the household, so the toilet_mdg variable created with combination of drainage variables*/ tab1 h0118 h0119 h0120, miss clonevar drain=h0118 codebook drain, tab(99) label define drain 1"Public network" 2"septic tank or septic tank (bio)" /// 3"pipe going to ravine or crevice" 4"pipe leading to river, lake or oceon" 5"Don't have drain", modify label values drain drain clonevar sanitation=h0119 codebook sanitation, tab(99) label define sanitation 1"Direct water discharge" 2"pour water out of bucket" /// 3"Can't put water" 4"don't have a sanitary service", modify label values sanitation sanitation gen toilet_mdg = 1 if drain>=1 & drain<=2 replace toilet_mdg = 0 if sanitation==3 | sanitation==4 | drain==5 replace toilet_mdg = 0 if (drain==3 | drain==4) & (sanitation==1 | sanitation==2) bys toilet_mdg: ta drain sanitation,m replace toilet_mdg = 0 if h0120==1 /* shared */ lab var toilet_mdg "Household has improved sanitation with MDG Standards" tab 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. */ //Survey doesn't collect information on the time for collecting water lookfor water tab1 h0112 h0113 h0114, miss clonevar piped_w=h0112 label define piped_w 1 "Inside the house" 2"Outside the ground" 3" Don't have piped water", modify label values piped_w piped_w tab piped_w, miss clonevar pipe_wsource=h0113 label define pipe_wsource 1"Public water source" 2"Well" 3"of a pipe" 4"from another house" /// 5 "From another place", modify label values pipe_wsource pipe_wsource tab pipe_wsource, miss clonevar nonpipe=h0114 label define nonpipe 1"Well" 2"Community socket/Key" 3"Another home" 4"Bring from water truck" /// 5"From river/stream" 6"rain", modify label values nonpipe nonpipe tab nonpipe, miss gen water_mdg=1 if piped_w==1| piped_w==2 replace water_mdg=1 if nonpipe==2 | nonpipe==3 | nonpipe==4 |nonpipe==6 replace water_mdg=0 if nonpipe==1 | nonpipe==5 tab water_mdg, m ******************************************************************************** *** Step 2.8 Housing *** ******************************************************************************** /* Members of the household are considered deprived if the household has a dirt, sand or dung floor */ lookfor floor codebook h0103, tab(99) clonevar floor=h0103 label define floor 1" Earth" 2"Cement" 3"Wood, mosaic or othe rcoating" label values floor floor tab floor,m gen floor_imp = 1 if floor==2 | floor==3 replace floor_imp = 0 if floor==1 lab var floor_imp "Household has floor that it is not earth/sand/dung" tab floor floor_imp, m /* Members of the household are considered deprived if the household has wall made of natural or rudimentary materials */ clonevar wall=h0102 codebook wall,tab(99) label define wall 1"waste material" 2"cardboard sheet" 3"Asbestos or metal sheet" /// 4"Reed, bamboo or palm" 5"Mud, wattle and daub, or straw" 6" Wood" 7"Adobe" /// 8 "Partition, brick, block, stone, quarry, cement, or concrete", modify label values wall wall tab wall, m gen wall_imp = 0 if wall<=5 replace wall_imp = 1 if wall>=6 & wall<=8 lab var wall_imp "Household has wall that it is not of low quality materials" tab wall wall_imp, m //Adobe categorised as rudimentary materials (need to verify) /* Members of the household are considered deprived if the household has roof made of natural or rudimentary materials */ lookfor roof clonevar roof=h0101 codebook roof, tab(99) label define roof 1"waster material" 2"Cardboard sheet" 3"Metal sheet" 4"Asbestos sheet" /// 5"Palm or straw" 6"Wood or tile" 7"Roof with beams" 8"tile" 9"Concrete slab or joist with vault", modify label values roof roof gen roof_imp=0 if roof<=5 replace roof_imp=1 if roof>=6 & roof<=9 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 */ lookfor fuel clonevar cookfuel=h0109 codebook cookfuel, tab(99) label define cookfuel 1"Firewood" 2"Coal" 3"Cylinder or stationary gas" /// 4"Natural or piped gas" 5"electricity" 6"Other fuel" 7"Don't cook" label values cookfuel cookfuel clonevar stove=h0110 codebook stove, tab(99) label define stove 1"Gas stove or grill" 2"Stove or electric grill" /// 3"Open fire or oven without chimney or hood" 4"Open fire or oven with chimney or hood" /// 5"Closed oven with chimney" 6"Other (Specify)" label values stove stove tab stove cookfuel, miss gen cooking_mdg=1 if (cookfuel>=3 & cookfuel<=7) | h0107==4 /* h0107=4 = no cocinan */ replace cooking_mdg=0 if cookfuel<=2 lab var cooking_mdg "Household has cooking fuel by MDG standards" /* Deprived if: "coal/lignite", "charcoal", "wood", "straw/shrubs/grass" "agricultural crop", "animal dung" */ bys cooking_mdg: ta stove cookfuel, m tab cooking_mdg, m ******************************************************************************** *** 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. */ lookfor tv television plasma lcd télé tele clonevar television=h0501a lookfor radio walkman stereo stéréo clonevar radio=h0501c lookfor téléphone ipod telefone tele celular *clonevar telephone=h0501h clonevar telephone=h0501f lookfor refrigerator réfrigérateur refri freezer clonevar refrigerator=h0501k lookfor automóvil camioneta clonevar car=h0501v clonevar truck=h0501w lookfor bicicleta lookfor ciclo gen bicycle=. /*No bicycle information*/ lookfor motorbike moto motocicleta clonevar motorbike=h0501x lookfor computadora ordinateur laptop ipad tablet clonevar computer=h0501e gen animal_cart=. /*No animal cart information*/ tab1 television radio telephone /*mobile*/ refrigerator car truck bicycle motorbike computer animal_cart, miss label define YesNo 0"No" 1"Yes", modify foreach i in television radio telephone /*mobile*/ refrigerator car truck bicycle motorbike computer animal_cart { replace `i'=0 if `i'==2 label values `i' YesNo } //Group telephone and mobiletelephone as a single variable *replace telephone=1 if mobile==1 //Group car and truck as a single variable replace car=1 if truck==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" tab hh_assets2, m ******************************************************************************** *** Step 2.11 Rename and keep variables for MPI calculation ******************************************************************************** lookfor stratum lookfor strata clonevar strata=region //Coding region as the strata clonevar psu=upm //Retain year, month & date of interview: gen year_interview = . gen month_interview = . gen date_interview = . //Generate presence of subsample gen subsample = . *** Rename key global MPI indicators for estimation *** /*recode hh_mortality (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 FOLIO_INT survey year subsample strata psu weight hh_weight area 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*/ hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 country countrycode tab1 /*d_cm*/ d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst, miss order hh_id FOLIO_INT country countrycode survey year subsample strata psu weight hh_weight area 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*/ hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 /* variables*/ bysort hh_id: gen hhnum=_n gen hh_numID=0 replace hh_numID=1 if hhnum==1 *** Sort, compress and save data for estimation *** sort FOLIO_INT compress save "$path_out/Mexico_national22_pov.dta", replace log close ******************************************************************************** *** MPI Calculation (TTD file) ******************************************************************************** **SELECT COUNTRY POV FILE RUN ON LOOP FOR MORE COUNTRIES use "$path_out\Mexico_national22_pov.dta", clear ******************************************************************************** *** Define Sample Weight and total population *** ******************************************************************************** gen sample_weight = weight ******************************************************************************** *** 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*/ /* 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/3 } // 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) rename FOLIO_INT ind_id clonevar ccty=countrycode clonevar cty=country 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 codebook, compact clear