**** Minimum Meal Frequency Code ****
* Last child in the last 2 years living with mother
* age in months
gen age = v008-b3
* drop if too old or not alive
keep if age<24 & b5==1
* keep only those children living with mother ...
keep if b9==0
* ... and keep the last born of those
drop if _n > 0 & caseid == caseid[_n-1]
drop if age<6
gen wt= v005/1000000
* among breastfed children 6-23 months, minimum meal frequency
* defined as receiving solid or semisolid food at least twice a day for
* infants age 6-8 months and at least 3 times a day for children age 9-23 months
gen minfreq1 = 0
replace minfreq1 =1 if (m39>1 & m39<8 & age>=6 & age<=8) | (m39>2 & m39<8 & age>=9 & age<=23)
*this is for breastfed children
ta minfreq1 if v404==1 [iw=wt]
* For nonbreastfed children age 6-23 months, minimum meal frequency is receiving
* solid or semisolid food or milk feeds at least 4 times a day.
* milk feeds
gen totmilkf = 0
replace totmilkf=totmilkf + v469e if v469e<8
replace totmilkf=totmilkf + v469f if v469f<8
replace totmilkf=totmilkf + v469x if v469x<8
* adding solid or semisolds
gen feedings=totmilkf
replace feedings= feedings + m39 if m39>0 & m39<8
gen minfreq2 =0
replace minfreq2 = 1 if feedings>=4
*this is for non-breastfed children
ta minfreq2 if v404==0 [iw=wt]
****
* Now we combine these variable to get the minimum meal frequency among all children
gen minfreq3=0
replace minfreq3=1 if minfreq1==1 & v404==1
replace minfreq3=1 if minfreq2==1 & v404==0
ta minfreq3 [iw=wt]
*this gives 35.9% and 69,690 children as in the final report
]]>