The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » INFANT AND YOUNG CHILD FEEDING PRACTICE
Re: INFANT AND YOUNG CHILD FEEDING PRACTICE [message #15458 is a reply to message #15369] Tue, 24 July 2018 10:43 Go to previous messageGo to previous message
Liz-DHS
Messages: 1516
Registered: February 2013
Senior Member
A response from one of our analysts, Rukundo Benedict:
Quote:

Dear User,
The code below will match the report. Your code was mostly correct, just a few errors. Always make sure to select the correct sample to match the report and check the variables for the combined food groups since these can differ slightly by country (e.g. the flesh foods was missing v414a v414t).
*Early Initiation of Breastfeeding*

*Generate weight variable**

gen wgt=v005/1000000

* keep only children less than 2 years 
gen age = v008-b3
keep if age<24
* keep last born children
keep if bidx==1
ta age [iw=wgt]

*Ever breastfed
gen everbf=.
replace everbf=1 if m4==93| m4==95
replace everbf=0 if m4==94
ta everbf [iw=wgt]

*EBF by age {note the sample is slightly different}*

*Generate weight variable**
gen wgt=v005/1000000

*Generate age, keep those <2 years
gen age = v008-b3
keep if age<24
*keep only those children alive 
ta b5
keep if b5==1

*Generate age groups
recode age (0/1=1 "0-1")(2/3=2 "2-3")(4/5=3 "4-5")(6/8=4 "6-8")(9/11=5 "9-11")(12/17=6 "12-17")(18/23=7 "18-23"), gen (age_months)

*Important Note: children must be the youngest child and living with mother
*keep only those living with mother
keep if b9==0
* finding the youngest child living with the mother
bysort v001 v002 v003: egen minbidx=min(bidx) 
* keep only children less than 2 years 
keep if age<24
ta bidx minbidx 
* need to drop those that are bidx==2 and minbidx==1
drop if bidx>minbidx
ta age_month [iw=wgt]


gen water=0
gen liquids=0
gen milk=0
gen solids=0
gen breast=0


*To determine if child is given water, sugar water, juice, tea or other  
replace water=1 if (v409>=1 & v409<=7)
                  
* If given other liquids
foreach xvar of varlist v409a v410 v410a v413*  {
replace liquids=1 if `xvar'>=1 & `xvar'<=7
}
                                                                                          
* If given powder/tinned milk, formula or fresh milk 
foreach xvar of varlist v411 v411a v412 v414p {
replace milk=1 if `xvar'>=1 & `xvar'<=7
}

*If currently breastfeeding
replace breast=1 if m4==95 


*If given any solid
foreach xvar of varlist v414* {
replace solids=1 if `xvar'>=1 & `xvar'<=7
}
replace solids=1 if v412a==1 | v412b==1 

gen feeding=1
replace feeding=2 if water==1
replace feeding=3 if liquids==1
replace feeding=4 if milk==1
replace feeding=5 if solids==1
replace feeding=0 if breast==0
label define feeding 0 "Not breastfeeding" 1 "exclusive breastfeeding" 2 "+Water" 3 "+Liquids" 4 "+Other Milk" 5 "+Solids"
label val feeding feeding


ta age_month feeding  [iw=wgt], row
ta age_month breast  [iw=wgt], row





*MMD MMF MAD*


*Generate weight variable**
gen wgt=v005/1000000

*Generate age, keep those <2 years
gen age = v008-b3
keep if age<24
*keep only those children alive 
ta b5
keep if b5==1
*children must be the youngest child and living with mother
*keep only those living with mother
keep if b9==0
* finding the youngest child living with the mother
bysort v001 v002 v003: egen minbidx=min(bidx) 
* keep only children less than 2 years 
keep if age<24
ta bidx minbidx 
* need to drop those that are bidx==2 and minbidx==1
drop if bidx>minbidx

*drop those under 6 months
drop if age<6

*Generate age groups
recode age (6/8=1 "6-8")(9/11=2 "9-11")(12/17=3 "12-17")(18/23=4 "18-23"), gen (age_months)
ta age_month [iw=wgt]



gen dairy=0
gen grains=0
gen VitA_vegfru=0
gen o_vegfru=0
gen eggs=0
gen tuber_roots=0
gen meats=0
gen legumes=0
gen breast=0

*If currently breastfeeding
replace breast=1 if m4==95 
label var breast "Currently breastfeeding"

* If given dairy
foreach xvar of varlist v411 v411a v414v v414p {
replace dairy=1 if `xvar'>=1 & `xvar'<=7
}     
label variable dairy "Dairy products"
                                             
* If given grains, roots, tubers
foreach xvar of varlist v412a v414e v414f {
replace grains=1 if `xvar'>=1 & `xvar'<=7
} 
label var grains "Grains, Roots, Tubers" 

* If given vit A fruits and veg
foreach xvar of varlist v414i v414j v414k {
replace VitA_vegfru=1 if `xvar'>=1 & `xvar'<=7
} 
label var VitA_vegfru "Vit A rich veg & fruits"

* If given other fruits and veg 
replace o_vegfru=1 if (v414l>=1 & v414l<=7) 
label var o_vegfru "Other veg & fruits"

* If given eggs
replace eggs=1 if (v414g>=1 & v414g<=7) 
label var eggs "Eggs"

* If given meats
foreach xvar of varlist v414a v414m v414n v414t {
replace meats=1 if `xvar'>=1 & `xvar'<=7
}  
label var meats "Meats"

* If given legumes_ nuts
replace legumes=1 if (v414o>=1 & v414o<=7)
label var legumes "legumes & nuts"


*Creating food groups 
gen allgroups= dairy + grains + VitA_vegfru + o_vegfru + eggs + meats + legumes
gen allgroups1= grains + VitA_vegfru + o_vegfru + eggs + meats + legumes


*Generate total milk foods
gen totmilkf=0
replace totmilkf=v469e if (v469e>0 & v469e<=7)
replace totmilkf=v469f if (v469f>0 & v469f<=7)
replace totmilkf=v469x if (v469x>0 & v469x<=7)
label var totmilkf "Total milk foods"


*feeding frequency for **Breastfeed** child age 6-8 months, 9-23 months  
gen minfeed=0
replace minfeed=1 if breast==1 & age_months==1 & (m39>=2 & m39<=7)
replace minfeed=1 if breast==1 & (age_months==2| age_months==3 |age_months==4) & (m39>=3 & m39<=7)

*feeding frequency for **Non-breastfeed** child age 6-23 months
gen feedings=totmilkf
replace feedings= feedings + m39 if (m39>0 & m39<=7)
replace minfeed=1 if breast==0 & feedings>=4 
 
 
*Generating MDD, MMF, MAD vars
gen MDD=0
replace MDD=1 if  breast==1 & allgroups>=4 
replace MDD=1 if  breast==0 & allgroups>=4 
label var MDD "Minimum diet diversity children"

gen MMF=0
replace MMF=1 if breast==1 & minfeed==1
replace MMF=1 if breast==0 & minfeed==1
label var MMF "Minimum meal frequency children"

gen MAD=0
replace MAD=1 if breast==1 & allgroups>=4 & minfeed==1
replace MAD=1 if breast==0 & allgroups1>=4 & minfeed==1 & totmilkf>=2
label var MAD "Minimum acceptable diet children"

gen milkp=0
replace milkp=1 if breast==1| totmilkf>=2
label var milkp "Milk/Milk products"


*Tabulation
local iycf "MDD MMF MAD milkp"
foreach xvar of varlist `iycf'{
ta age_months `xvar' if breast==1 [iw=wgt], row
ta age_months `xvar' if breast==0 [iw=wgt], row
ta age_months `xvar' [iw=wgt], row
}

clear 

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Append datasets about breastfeeding indicators
Next Topic: Correct stunting rate but wrong number of PSUs
Goto Forum:
  


Current Time: Mon Dec 23 09:52:46 Coordinated Universal Time 2024