*********************************************************************************************************************** ** Human Development Report Office (HDRO), United Nations Development Programme ** Multidimensional Poverty Index 2023 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_2023\NationalSurveys\Mexico_2021" global path_out "C:\UNDP\MPI\MPI_Computation\MPI_2023\NationalSurveys\Mexico_2021" global path_logs "C:\UNDP\MPI\MPI_Computation\MPI_2023\NationalSurveys\Mexico_2021" global path_qc "C:\UNDP\MPI\MPI_Computation\MPI_2023\NationalSurveys\Mexico_2021" global path_ado "C:" *** Log file *** log using "$path_logs/Mexico_national21_dataprep.log", replace ******************************************************************************** *** Mexico ENSAUT Survey 2021 *** ******************************************************************************** ******************************************************************************** *** 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 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. However, the non-reponse rate for anthropometric measurement was high, where only 58% of 12619 households had at least one person with measurement data. This resulted in the global MPI sample for Mexico as 64% (weighted), resulted in 36% drop of the weighted sample, mainly due to missing anthropometric information. The bias analysis showed significant differences in household attributes between those with and without nutrition information. Furthermore, the dataset doesn't provide variable that identify individuals from 5-9 years, 10-19 years, 20-34 years, 35-49 years, and 50+ selected (eligible) for measurement, therefore, we can't identify those who are eligible and regused to be measured from the dataset. For the Mexico ENSANUT survey, we decided to proceed with only including nutrition information from under-five children. All under-five children were eligible for measurement (Mexico ENSANUT report; p.g 19), and the non-response rate is lower among children. If we contructed nutrition indicator using children under 5, then the retained sample for the Mexico data is 89% (weighted), so only 11% of the weighted sample is dropedped. The bias test also indicate the missing is random, and thus, not problematic. */ use "$path_in/nutrition_mexico21.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 gen bdate1=mdy(monthdob, daydob, yeardob) //Constructing date of birth from dataset dob variable gen bdate = date(fech_nac, "DMY") // birth date format bdate %td compare bdate1 bdate //"fech_nac" variable contains less missing values, so we proceed with "fech_nac" for further computation. drop bdate1 *Generating interview date variable gen interviewd=fecha_fin_1 replace interviewd=fecha_fin_2 if fecha_fin_2!=" " replace interviewd=fecha_fin_3 if fecha_fin_3!=" " replace interviewd=fecha_fin_4 if fecha_fin_4!=" " //Calculate birth date in days from date of interview gen mdate=date(interviewd, "DMY") 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.35 kilograms **recoding problematic measurements replace an01_1=. if an01_1>222 replace an01_2=. if an01_2>222 //222.22=person weight not measured **Taking average of two measurements egen weight=rmean(an01_1 an01_2) sum weight 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 *** BODY WEIGHT (KILOGRAMS) for 60 years and above** *Recoding amputation variable tab an11 label define an11 1"Yes, of upper extremities and walks" 2" Yes, of upper extremities and does not walk" 3"Yes, lower extremities" /// 4"No and can stand up" 5"No and he can only sit down" 6"No and he's confined to a bed", modify label values an11 an11 tab an11, m tab an11 an22, m /*Participants who had upper extremities amputed and able to walk had weight and height measured, while participants with lower entremities amputed, not able to sit down, and confined to bed were skipped anthropometric measurement. For anthropometric varaible computation, we follow as per the report*/ codebook an12_1, tab(999) codebook an12_2, tab(999) compare an12_1 an12_2 //Difference between two measurements within +/- 0.35 kilograms **recoding problematic measurements replace an12_1=. if an12_1>222 replace an12_2=. if an12_2>222 //222.22=person weight not measured *Averaging two weight measurements for individuals aged 60 years and above egen weight_over60= rmean(an12_1 an12_2) *Result of weight measurement for individuals aged 60 and over label values an14 an03 tab an14 if weight_over60>=222 | weight_over60==., miss //37 missing values for weight explained. ***Combining the weight varaible for under 60 and 60 or above years *Replacing the weight variable to include measurements from 60 years and above individuals replace weight=weight_over60 if weight==. & h0303>=60 desc weight codebook weight sum weight if h0303<60 sum weight if h0303>=60 sum 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: HEIGHT (CENTIMETERS) for 60 years and above** *Two height measurements were recorded per individual, we only consider the first measurement codebook an15_1, tab(9999) /*first measurement*/ codebook an15_2, tab (9999) /*second measurement*/ compare an15_1 an15_2 //Difference between two height measurements within +/- 1 cm *recoding problematic measurements replace an15_1=. if an15_1>222 replace an15_2=. if an15_2>222 //222.22=person height not measured **Taking average of two measurements egen height_over60 = rmean(an15_1 an15_2) lookfor an16 tab an16, m //an16 = result of height measurement label values an16 lab_height tab an16 if height_over60>=222 | height_over60==., m //55 missing values for height explained desc height_over60 codebook height_over60 ***Combining the height varaible for under 60 and 60 or above years *Replacing the weight variable to include measurements from 60 years and above individuals replace height=height_over60 if height==. & h0303>=60 desc height codebook height sum height if h0303<60 sum height if h0303>=60 sum 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". I assumed measurements taken for less than 24 months as "lying" and =>24 months as "standing up" , but it needs to be verified.*/ gen measure = "l" if age_months<=23 //Child measured lying down replace measure = "h" if age_months>23 & 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/Mexico21_anthropometric.dta", replace count //15926 observations ****************************************************************************** *** Step 1.1a Nutrition indicators for children under 5 ******************************************************************************** use "Mexico21_anthropometric.dta", clear sort ind_id gen child_KR=1 if age_month<61 * 1,786 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 2021, 7 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/Mexico21_KR.dta", replace ******************************************************************************** *** Step 1.1b BMI-for-age for individuals above 5 and 19 years ******************************************************************************** /* use "Mexico21_anthropometric.dta", clear /*replacing the missing age_months (computed age_months) with age (in years) information available in the dataset replace age_months= h0303*12+6 if age_months==. & h0303>=5 & h0303<=19 */ keep if age_months>=61 & age_months<229 *** 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 = "teen_nutri_Mexico" 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/teen_nutri_Mexico_z.dta", clear gen z_bmi = _zbfa replace z_bmi = . if _fbfa==1 lab var z_bmi "z-score bmi-for-age WHO" *** Standard MPI indicator *** 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" tab low_bmiage, miss //Identification variable for children above 5 years and under 19 years gen teen_IR=1 sort hh_id ind_id duplicates report hh_id ind_id //No duplicates at this stage //Retain relevant variables: keep FOLIO_I FOLIO_INT hh_id ind_id teen_IR age_months low_bmiage gender ponde_f order FOLIO_I FOLIO_INT hh_id ind_id teen_IR age_months low_bmiage gender ponde_f sort FOLIO_I FOLIO_INT /*Append the nutrition information of children above 5 years with children under 5 */ append using "$path_out/Mexico21_KR.dta" count //Total 6213 observations sort FOLIO_I FOLIO_INT save "$path_out/Mexico21_children.dta", replace //Erase files from folder: erase "$path_out/teen_nutri_Mexico_z.xls" erase "$path_out/teen_nutri_Mexico_prev.xls" *erase "$path_out/teen_nutri_Mexico_z.dta" ******************************************************************************** *** Step 1.1c BMI for all individuals in the dataset ******************************************************************************** use "Mexico21_anthropometric.dta", clear keep if age_months>=229 & age_months<841 //Weight and height information used for computing BMI only for under 70 years population //8318 observations gen bmi=(weight)/((height/100)^2) label variable bmi "BMI for adults (19-70 yrs) population" gen adult_IR=1 append using "$path_out/Mexico21_children.dta" count //Total 14531 observations rename weight weight_kg rename height height_cm rename gender gender_nutri rename age_month age_month_nutr duplicates report FOLIO_I FOLIO_INT sort FOLIO_INT //Save a temp file for merging later: save "$path_out/Mexico21_nutrition.dta", replace */ ******************************************************************************** *** Step 1.2 Child Mortality ******************************************************************************** ******************************************************************************** *** Step 1.2a Child Mortality from adolescents (12-19 yrs) ******************************************************************************** /* use "ChildMortality_teen.dta", clear rename edad age tab age, m keep if age>=12 & age<=19 //We select only individuals aged 12 and over. rename sexo sex tab sex, m //1 "Male" 2"Female" keep if sex==2 //Child mortality information only collected from female replace child_died = 0 if d0313==2 /* never pregnant */ replace child_died = 0 if d0316d==0 & d0316e==0 /* no child died */ replace child_died = 0 if d0316c==0 & ((d0316a>0 & d0316a<.) | (d0316b>0 & d0316b<.)) /* abortions and stillbirths are considered not deprived */ replace child_died = 0 if d0314==1 & d0315==1 /* currently pregnant for first time */ replace child_died = 1 if (d0316d>=1 & d0316d<.) | (d0316e>=1 & d0316e<.) /* at least one child died */ gen Teen_CM=1 duplicates report FOLIO_IN keep FOLIO_I FOLIO_INT d0305 d0313 d0316a d0316b d0316c d0316d d0316e child_died Teen_CM ponde_f sort FOLIO_I FOLIO_INT save "$path_out/Mexico21_ChdMor_teen.dta", replace ******************************************************************************** *** Step 1.2b Child Mortality from adults (20-49 yrs) ******************************************************************************** use "ChildMortality_Adult.dta", clear rename edad age tab age, m keep if age>=20 & age<=49 //We select only individuals aged 12 and over. rename sexo sex tab sex, m //1 "Male" 2"Female" keep if sex==2 //Child mortality information only collected from female gen child_died = 0 if a0801==0 /* never had sex */ replace child_died = 0 if a0806==0 /* period did not start */ replace child_died = 0 if a0807==2 /* never pregnant */ replace child_died = 0 if a0810ad==0 & a0810ae==0 /* no child died */ replace child_died = 0 if a0810c==0 & ((a0810a>0 & a0810a<.) | (a0810b>0 & a0810b<.)) /* abortions and stillbirths are considered not deprived */ replace child_died = 0 if a0808==1 & a0809==1 /* currently pregnant for first time */ replace child_died = 1 if (a0810ad>=1 & a0810ad<.) | (a0810ae>=1 & a0810ae<.) /* at least one child died */ gen adult_CM=1 duplicates report FOLIO_INT keep FOLIO_I FOLIO_INT a0801 a0806 a0807 a0808 a0809 a0810a a0810b a0810c a0810ad a0810ae child_died adult_CM ponde_f append using "$path_out/Mexico21_ChdMor_teen.dta" duplicates report FOLIO_INT //It appears 2 observations has the same individual ID duplicates tag FOLIO_INT, gen(dup_id) *browse if dup_id==1 /*One observtion in the adult child mortality data has no weights, so we will delete this observation.*/ drop if dup_id==1 & ponde_f==. drop dup_id duplicates report FOLIO_INT sort FOLIO_I FOLIO_INT save "$path_out/Mexico21_CM.dta", replace */ ******************************************************************************** *** Step 1.3 HOUSEHOLD RECODE ******************************************************************************** use "$path_in/hh.dta", clear *** Generate a household unique key variable at the household level using: gen hh_weight=ponde_f sort FOLIO_I save "$path_out/mexico21_hh.dta", replace ******************************************************************************** *** Step 1.4 HOUSEHOLD MEMBER RECODE ******************************************************************************** use "$path_in/hh_member.dta", clear gen country = "Mexico" gen countrycode = "MEX" gen year = "2021" 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/mexico21_hh.dta" // 43724 observations matched (100%) drop _merge erase "$path_out/mexico21_hh.dta" *** Merging nutrition data *************************************************** merge 1:1 FOLIO_I FOLIO_INT using "$path_out/Mexico21_KR.dta", force // drop _merge erase "$path_out/Mexico21_anthropometric.dta" erase "$path_out/Mexico21_KR.dta" *erase "$path_out/Mexico21_nutrition.dta" *erase "$path_out/MEX20_NUTRI.dta" /* *** Merging child mortality data *************************************************** merge 1:1 FOLIO_I FOLIO_INT using "$path_out/Mexico21_CM.dta" //6073 observations matched drop _merge erase "$path_out/Mexico21_CM.dta" erase "$path_out/Mexico21_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: 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. *This variable was not identified in the dataset (needs to be confirmed). 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 /*Three different variables for the region: "region", "x_region" and "region_s" All contains the same information, except "region_s" has unlabeled option-10, coded within "Guanajuat" region for other "region" variables.*/ tab region, miss 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, teen aged 5-19 years and adult populaton aged 20-70 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 h0304 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 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 /* replace h0303=. if h0303==999 gen age_month_all = (h0303*12) + meses count if age_month_all<=840 sum age_month_all */ *41006 individuals aged 0-70 years with anthropometric information *** No eligible children 0-4 years **************************************** gen child_eligible = (age_month_all>=0 & age_month_all<61) 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 /* *** No eligible teen 5-18 years **************************************** gen teen_eligible=(age_month_all>=61 & age_month_all<229) bys hh_id: egen hh_n_teen_eligible = sum(teen_eligible) //Number of eligible children for anthropometrics gen no_teen_eligible = (hh_n_teen_eligible==0) //Takes value 1 if there were no eligible children for anthropometrics lab var no_teen_eligible "Household has no children aged 5-18 years eligible" tab no_teen_eligible, miss *** No eligible adult 19-70 years **************************************** gen adult_eligible = (age_month_all>=229 & age_month_all<841) bysort hh_id: egen n_adult_eligible = sum(adult_eligible) gen no_adult_eligible = (n_adult_eligible==0) lab var no_adult_eligible "Household has no eligible adult 19-59 years eligible" tab no_adult_eligible, m *** No eligible children, teen and adult population ********************************************************* gen no_eligibles = (no_adult_eligible==1 & no_teen_eligible==1 & no_child_eligible==1) lab var no_eligibles "Household has no eligible women, men, or children" tab no_eligibles, miss drop child_eligible hh_n_children_eligible teen_eligible hh_n_teen_eligible adult_eligible n_adult_eligible */ 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 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 edulevel grade, 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. n=150 individuals with eduyears=6 changed to zero. */ 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 *** ******************************************************************************** /* *** BMI Indicator for adult 19-70 years *** ******************************************************************* gen adult_bmi = bmi //Low BMI of adult 19-70 years lab var adult_bmi "Adult's BMI" gen adult_low_bmi = (adult_bmi<18.5) replace adult_low_bmi = . if adult_bmi==. | adult_bmi>=99.90 replace adult_low_bmi = . if age_month_all<=228 replace adult_low_bmi = . if age_month_all>=841 & age_month_all<. //Only considering BMI for individuals aged 70 years or less lab var adult_low_bmi "BMI of adult population < 18.5" *** BMI indicator for the children (5-19 years) gen low_bmi_teen = low_bmiage lab var low_bmi_teen "Teen with low BMI or BMI-for-age" */ *** Child Either Stunted or Underweight Indicator *** ************************************************************************ 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 ******************************************************************************** *** 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 *** ******************************************************************************** **Constructing women eligiblity for the child mortality indicator ** No eligible women (aged 12-49 years /*and had sexual relationship*/) gen women_eligible= (sex==2 & age>=12 & age<=49) bysort hh_id: egen n_female_eligible = sum(women_eligible) gen no_female_eligible = (n_female_eligible==0) lab var no_female_eligible "Household has no eligible female 12-49 years eligible" tab no_female_eligible, m replace child_died=0 if no_female_eligible==1 tab child_died, m bysort hh_id: egen child_mortality_f = sum(child_died), missing lab var child_mortality_f "Occurrence of child mortality reported by women" tab child_mortality_f, miss /*Deprived if any children died in the household */ ************************************************************************ gen hh_mortality = (child_mortality_f==0) /*Household is replaced with a value of "1" if there is no incidence of child mortality*/ replace hh_mortality = . if child_mortality_f==. lab var hh_mortality "Household had no child mortality ever" tab hh_mortality, miss */ ******************************************************************************** *** Step 2.5 Electricity *** ******************************************************************************** /*Members of the household are considered deprived if the household has no electricity */ lookfor electricity 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 label define drain 1"Public network" 2"septic tank or septic tank (bio)" /// 3"pipe going to ravine" 4"pipe leading to river, lake" 5"Don't have drain", modify label values drain drain clonevar sanitation=h0119 label define sanitation 1"Direct water discharge" 2"pour water out of bucket" /// 3"Can't put water" 4"don't have a toilet", modify label values sanitation sanitation gen toilet_mdg = 1 if drain>=1 & drain<=4 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 drain,m replace toilet_mdg = 0 if h0120==1 /* shared */ lab var toilet_mdg "Household has improved sanitation with MDG Standards" tab toilet_mdg, miss /* tab sanitation, miss H0119 Does the sanitary | service... | Freq. Percent Cum. -------------------------+----------------------------------- Direct water discharge | 30,794 70.43 70.43 pour water out of bucket | 11,585 26.50 96.92 Can't put water | 922 2.11 99.03 don't have a toilet | 285 0.65 99.68 . | 138 0.32 100.00 -------------------------+----------------------------------- Total | 43,724 100.00 tab drain, miss H0118 Does this dwelling have a | drain or drain connected to... | Freq. Percent Cum. ---------------------------------+----------------------------------- Public network | 34,136 78.07 78.07 septic tank or septic tank (bio) | 8,568 19.60 97.67 pipe going to ravine | 272 0.62 98.29 pipe leading to river, lake | 81 0.19 98.47 Don't have drain | 529 1.21 99.68 . | 138 0.32 100.00 ---------------------------------+----------------------------------- Total | 43,724 100.00 */ ******************************************************************************** *** 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 pipe" /// 5"From river/stream" 6"rain" 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 //Only source from river/stream categorise as not meeting mdg criteria (need to verify) bys water_mdg: ta nonpipe piped 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 clonevar floor=h0103 label define floor 1" Earth" 2"Cement" 3"Wood, mosaic or othe rcoating" label values floor floor 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 */ lookfor wall clonevar wall=h0102 label define wall 1"waste material" 2"cardboard sheet" 3"Asbestos or metal sheet" /// 4"Reed, bamboo or palm" 5"Embarro, bajareque or straw" 6" Wood" 7"Adobe" /// 8 "Partition, brick, block, stone, canter", 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 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 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 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. */ clonevar television=h0501a clonevar radio=h0501c clonevar telephone=h0501h clonevar mobile=h0501f clonevar refrigerator=h0501k clonevar car=h0127b clonevar truck=h0127c gen bicycle=. /*No bicycle information*/ clonevar motorbike=h0127d 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_national21_pov.dta", replace log close ******************************************************************************** *** MPI Calculation (TTD file) ******************************************************************************** **SELECT COUNTRY POV FILE RUN ON LOOP FOR MORE COUNTRIES use "$path_out\Mexico_national21_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) *** Prepare results to export *** keep country year survey per_sample_weighted* per_sample* MPI* H* A* vulnerable* severe* raw* cen* cont* var *gen temp = (_n) *keep if temp==1 *drop temp order MPI_1 H_1 A_1 var severe_1 vulnerable_1 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