The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » Breastfeeding status by age
Breastfeeding status by age [message #9568] Mon, 18 April 2016 15:07 Go to next message
tony is currently offline  tony
Messages: 10
Registered: March 2013
Location: Ghana


I am trying to get the breastfeeding status of children under 2 years. I am using Ghana Demographic and Health Survey 2014. I have tried categorizing all the foods taken by the children as captured by the survey but I am not getting the corresponding figures as in the GDHS report. Thus, Table 11.3: Breastfeeding Status by age. Below are the STATA codes I used. I am using the GHKR70FL file. Any help! Thanking you.

**** To get the last children of 2 yrs living with mom *****
gen age = v008-b3
keep if age<24 & b5==1
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")(24/59=.), gen(child_age)
tab child_age
gen peso=v005/1000000
tab child_age[iw=peso]
keep if b9==0
drop if _n > 0 & caseid == caseid[_n-1]
tab child_age
tab child_age[iw=peso]

numlabel, add


*The number of times the children received anything to eat
///aside from breast milk, including both meals and snacks///
//Children who are being exclusively breastfed are coded 0

tab m39

*Recoding m39 to get exclusively breastfed and not exclusively breastfed
recode m39(0=0 "exclusive")(1/8=1 "not_exclusive"), gen(exclv_breast)
tab exclv_breast

*Adding sample weight
tab exclv_breast [iw=peso]

*crosstab with children (0-23m) - [However the results didn't correspond
//with the report especially the 'Exclusive breastfeeding column. The not
//exclusively breastfed I suppose is for children who took some foods]
tab child_age exclv_breast [w=v005], row nofreq

*Recoding the variable M4=duration of breastfeeding the child in months
tab m4

*93 ever breastfed, not currently breastfeeding
*94 never breastfed
*95 Still breastfeeding

****** Generating a new variable "breastfed" for children BF and those not BF *****
gen breastfed=.
replace breastfed=1 if m4!=. & m4<=94
replace breastfed=2 if m4!=. & m4==95
tab breastfed, mis

gen breastfedd=.
replace breastfedd=1 if m4<=94
replace breastfedd=2 if m4==95
tab breastfedd

recode breastfed(1=0 "ever/never breastfed")(2=1 "still breastfeeding"), gen(breastfeding)
numlabel, add
tab breastfeding

**** Further grouping of water and other foods (in order to get a composite table of the 5 categories as stated in Table 11.3) *****

* Finding children who took water only
tab v409
recode v409(0=0)(1=1 "water_yes")(8/9=.), gen(plainwater)
tab plainwater

*Generating new variable for "Breastfeeding and plainwater"
gen bf_plwater=.
replace bf_plwater=1 if breastfeding!=. & breastfeding==0
replace bf_plwater=1 if plainwater!=. & plainwater==0
replace bf_plwater=2 if breastfeding!=. & breastfeding==1
replace bf_plwater=2 if plainwater!=. & plainwater==1
tab bf_plwater
recode bf_plwater (1=0 "not both")(2=1 "took both"), gen(bf_plwter)
numlabel, add
tab bf_plwter
tab child_age bf_plwter, row nofreq

* Finding children who consumed non-milk liquids
tab v410
recode v410(0=0)(1=1 "juice_yes"), gen(juice)
tab juice

tab v413
recode v413(0=0)(1=1 "otherliq_yes"), gen(other_liq)
tab other_liq

tab v412c
recode v412c(0=0)(1=1 "broth_yes"), gen(clear_broth)
tab clear_broth

******** Generating a single variable for
//Children were breastfeeding and took non-milk liquids *******

gen bf_nomilk=.
replace bf_nomilk=1 if breastfeding!=. & breastfeding==0
replace bf_nomilk=1 if juice!=. & juice==0
replace bf_nomilk=1 if other_liq!=. & other_liq==0
replace bf_nomilk=1 if clear_broth!=. & clear_broth==0
replace bf_nomilk=2 if breastfeding!=. & breastfeding==1
replace bf_nomilk=2 if juice!=. & juice==1
replace bf_nomilk=2 if other_liq!=. & other_liq==1
replace bf_nomilk=2 if clear_broth!=. & clear_broth==1
tab bf_nomilk
recode bf_nomilk (1=0 "not all")(2=1 "took all"), gen(bf_nonmilk)
numlabel, add
tab bf_nonmilk
tab child_age bf_nonmilk, row nofreq

* Finding children who consumed other milk
tab v411
recode v411(0=0)(1=1 "tin_yes"), gen(tin)
tab tin

tab v411a
recode v411a(0=0)(1=1 "formula_yes"), gen(formula)
tab formula

tab v414p
recode v414p(0=0)(1=1 "cheese_yes"), gen(cheese)
tab cheese

tab v414v
recode v414v(0=0)(1=1 "yogurt_yes"), gen(yogurt)
tab yogurt

***** Generating a single variable for
//children who breastfed and consumed other milk *******

gen bf_othermilk=.
replace bf_othermilk=1 if breastfeding!=. & breastfeding==0
replace bf_othermilk=1 if tin!=. & tin==0
replace bf_othermilk=1 if formula!=. & formula==0
replace bf_othermilk=1 if cheese!=. & cheese==0
replace bf_othermilk=1 if yogurt!=. & yogurt==0
replace bf_othermilk=2 if breastfeding!=. & breastfeding==1
replace bf_othermilk=1 if tin!=. & tin==1
replace bf_othermilk=1 if formula!=. & formula==1
replace bf_othermilk=1 if cheese!=. & cheese==1
replace bf_othermilk=1 if yogurt!=. & yogurt==1
tab bf_othermilk
recode bf_othermilk (1=0 "not all")(2=1 "took all"), gen(bf_othrmilk)
numlabel, add
tab bf_othrmilk
tab child_age bf_othrmilk, row nofreq

*finding children who consumed complementary foods
tab v412a
recode v412a(0=0)(1=1 "cerelac_yes"), gen(cerelac)
tab cerelac

tab v414e
recode v414e(0=0)(1=1 "bread_yes"), gen(bread)
tab bread

tab v414f
recode v414f(0=0)(1=1 "pota_yes"), gen(potatoes)
tab potatoes

tab v414g
recode v414g(0=0)(1=1 "eggs_yes"), gen(eggs)
tab eggs

tab v414h
recode v414h(0=0)(1=1 "meat_yes"), gen(meat)
tab meat

tab v414i
recode v414i(0=0)(1=1 "pump_yes"), gen(pumpkin)
tab pumpkin

tab v414j
recode v414j(0=0)(1=1 "dark_yes"), gen(darkgreen)
tab darkgreen

tab v414k
recode v414k(0=0)(1=1 "mango_yes"), gen(mangoes)
tab mangoes

tab v414l
recode v414l(0=0)(1=1 "fruit_yes"), gen(fruits)
tab fruits

tab v414m
recode v414m(0=0)(1=1 "liver_yes"), gen(liver)
tab liver

tab v414n
recode v414n(0=0)(1=1 "fish_yes"), gen(fish)
tab fish

tab v414o
recode v414o(0=0)(1=1 "beans_yes")(9=.), gen(beans)
tab beans

tab v414s
recode v414s(0=0)(1=1 "solid_yes")(8/9=.), gen(solidfood)
tab solidfood

***** Generating a single variable for children
// breastfeeding and consumed complementary foods ***************

gen bf_comple=.
replace bf_comple=1 if breastfeding!=. & breastfeding==0
replace bf_comple=1 if cerelac!=. & cerelac==0
replace bf_comple=1 if bread!=. & bread==0
replace bf_comple=1 if potatoes!=. & potatoes==0
replace bf_comple=1 if eggs!=. & eggs==0
replace bf_comple=1 if meat!=. & meat==0
replace bf_comple=1 if pumpkin!=. & pumpkin==0
replace bf_comple=1 if darkgreen!=. & darkgreen==0
replace bf_comple=1 if mangoes!=. & mangoes==0
replace bf_comple=2 if fruits!=. & fruits==0
replace bf_comple=1 if liver!=. & liver==0
replace bf_comple=1 if fish!=. & fish==0
replace bf_comple=1 if beans!=. & beans==0
replace bf_comple=1 if solidfood!=. & solidfood==0
replace bf_comple=1 if breastfeding!=. & breastfeding==1
replace bf_comple=1 if cerelac!=. & cerelac==1
replace bf_comple=1 if bread!=. & bread==1
replace bf_comple=1 if potatoes!=. & potatoes==1
replace bf_comple=1 if eggs!=. & eggs==1
replace bf_comple=1 if meat!=. & meat==1
replace bf_comple=1 if pumpkin!=. & pumpkin==1
replace bf_comple=1 if darkgreen!=. & darkgreen==1
replace bf_comple=1 if mangoes!=. & mangoes==1
replace bf_comple=2 if fruits!=. & fruits==1
replace bf_comple=1 if liver!=. & liver==1
replace bf_comple=1 if fish!=. & fish==1
replace bf_comple=1 if beans!=. & beans==1
replace bf_comple=1 if solidfood!=. & solidfood==1
tab bf_comple
recode bf_comple (1=0 "not all")(2=1 "took all"), gen(bf_compl)
numlabel, add
tab bf_compl
tab child_age bf_compl, row nofreq

**** Generating a composite variable for "Breastfeeding Status"
//EBF; BF+Water;BF+Nonmilk; BF+Other milk; BF+Comple

tab exclv_breast
tab breastfeding
tab bf_plwter
tab nonmilk
*BF+Other milk
tab othrmilk
tab bf_compl

*Now putting all the categories together to get the 5 breastfeeding status groups
gen bf_stats=.
replace bf_stats=1 if exclv_breast!=. & exclv_breast==0
replace bf_stats=1 if exclv_breast!=. & exclv_breast==1
replace bf_stats=2 if bf_plwter!=. & bf_plwter==0
replace bf_stats=2 if bf_plwter!=. & bf_plwter==1
replace bf_stats=3 if bf_nonmilk!=. & bf_nonmilk==0
replace bf_stats=3 if bf_nonmilk!=. & bf_nonmilk==1
replace bf_stats=4 if bf_othrmilk!=. & bf_othrmilk==0
replace bf_stats=4 if bf_othrmilk!=. & bf_othrmilk==1
replace bf_stats=5 if bf_compl!=. & exclv_breast==0
replace bf_stats=5 if bf_compl!=. & bf_compl==1

*To get the various breastfeeding status of children under 2 years
tab bf_stats
recode bf_stats (1=0 "not all")(2=1 "took all"), gen(bf_status)
numlabel, add
tab bf_status
tab child_age bf_status, row nofreq
Re: Breastfeeding status by age [message #9598 is a reply to message #9568] Wed, 20 April 2016 12:56 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 800
Registered: January 2013
Senior Member
I'm including below code for calculating the left hand part of table 11.3. The first part for the selection of cases is essentially your code - this selected the last born child living with the mother under the age of 2 years. The second half of the code classifies the breastfeeding status according to the categories in table 11.3. I didn't go through your code in detail, but a couple of notes on the classification:
1) We don't use m39 at all in this classification. Instead it is purely based on the list of foods that the child received in the last 24 hours.
2) The code below is generalized to work with more surveys than just the survey you are interested in. In the Ghana survey the v409-v414w series of variables are coded 0=No,1=Yes,8=DK,9=Missing, but in some surveys the code 1 can actually be values 1-7 for the number of times the child received the food or liquid. The code below will work with either coding.
3) Table 11.3 assumes a hierarchy order as follows:
1 Exclusively breastfed
2 Breastfeeding and consuming plain water only
3 Breastfeeding and consuming non-milk liquids
4 Breastfeeding and consuming other milk
5 Breastfeeding and consuming complementary foods
with the higher number in the list taking priority, and the code being written to follow that priority order.

use "GHKR70FL.DTA" 

* 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
* recode age into 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")(24/59=.), gen(child_age)
* tab of all living children born in the last 2 years
tab child_age
tab child_age [iw=v005/1000000]

* 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]
* check the deonimnator
tab child_age
tab child_age [iw=v005/1000000]

* Breastfeeding status.

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

* Water
replace water=1 if (v409>=1 & v409<=7) 
* Other non-milk liquids
* check for country specific liquids
foreach xvar of varlist v409a v410 v410a v412c v413* {
	replace liquids=1 if `xvar'>=1 & `xvar'<=7
* Powdered or tinned milk, formula, fresh milk
foreach xvar of varlist v411 v411a v412 {
	replace milk=1 if `xvar'>=1 & `xvar'<=7

* Solid food
* check for country specific foods
foreach xvar of varlist v412a v412b v414* {
	replace solids=1 if `xvar'>=1 & `xvar'<=7

* Still breastfeeding
replace breast=1 if m4==95 

tab1 water liquids milk solids breast

* Generate column variable used in table 11.3
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 
tab feeding,m

label define feeding ///
  0 "Not breastfeeding" 1 "Exclusive breastfeeding" ///
  2 "+Water" 3 "+Liquids" ///
  4 "+Other Milk" 5 "+Solids"
label val feeding feeding
tab child_age feeding [iweight=v005/1000000], row
Re: Breastfeeding status by age [message #9609 is a reply to message #9598] Fri, 22 April 2016 01:23 Go to previous messageGo to next message
tony is currently offline  tony
Messages: 10
Registered: March 2013
Location: Ghana

Dear Trevor,

Thank you very much.
I've learned more Stata codes from your response.
Re: Breastfeeding status by age [message #9649 is a reply to message #9598] Thu, 28 April 2016 17:12 Go to previous messageGo to next message
flam0119 is currently offline  flam0119
Messages: 6
Registered: April 2014
Dear Trevor,

I replicated your coding for Kenya's 2014 DHS as I'm interested in the breastfeeding status results by counties. However, the denominators are double what they are in the report. I am using the Stata KR file.

I see that the 2014 Kenya DHS sampling design and questionnaire was adapted for the county level; thus, there were 5 questionnaires conducted: full household survey, full women's survey, full men's survey, short household survey, and short women's survey. How do I drop observations from the short questionnaire?

Thanks in advance,

[Updated on: Thu, 28 April 2016 19:24]

Report message to a moderator

Re: Breastfeeding status by age [message #9650 is a reply to message #9649] Fri, 29 April 2016 01:06 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 800
Registered: January 2013
Senior Member
The Kenya DHS 2014 uses a split sample with a long or a short household questionnaire and a long or a short women's questionnaire. The short questionnaires are subsets of the long questionnaires. The questions that exist in both the short and long questionnaire are used to provide disaggregated estimates at the county level. The questions only included in the long questionnaire only provide estimates for indicators at higher levels of disaggregation. The short questionnaires were used in the same half of all households used for the men's questionnaire.

The data for the breastfeeding indicators were only collected in the short questionnaire. With the IR or KR files, the easiest way to identify these cases is actually using v044 (selection for domestic violence) as the same households selected for the men's survey were eligible for the domestic violence module. Thus to select the cases you need for analysis, select case where v044 != .

Note, though, that the sample was not designed to produce county level estimates for these breastfeeding indicators (otherwise these questions would have also been included in the short questionnaire).
Re: Breastfeeding status by age [message #14147 is a reply to message #9598] Mon, 26 February 2018 01:36 Go to previous message
kbietsch is currently offline  kbietsch
Messages: 14
Registered: November 2015
Location: Washington, DC USA

Thanks for the code- it works for the Nepal 2016 DHS!

Just changed the age variable to:
gen age = b19
to reflect the use of CDC (instead of CMC)
Previous Topic: Format of Percentile and SD
Next Topic: DHS Household Weights - Arrondisment Scale
Goto Forum:

Current Time: Wed Jul 24 01:19:48 Coordinated Universal Time 2024