 The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in SPSS » Calculating cases for IYCF
Re: Calculating cases for IYCF [message #14985 is a reply to message #14981] Wed, 23 May 2018 19:48   Roselync Messages: 19Registered: December 2016 Location: Taiwan Member
Dear Bridgette,
Thank you so much for your kind help. I tried to replace the variable for age using the syntax you gave me. However, the age seems not to match with that of the report. For instance, the total sample for children aged 0-5 months who practiced exclusive breastfeeding is 1715; for 9-11 months it is 888. Kindly enlighten me on where I might have gone wrong. Below is the SYNTAX that I used to create the age variable and breastfeeding practices (early initiation of breastfeeding, exclusive breastfeeding, predominant breastfeeding and bottle feeding:

gen age=b19

keep if age<24

. keep if bidx==1

ta age [iw=v005/1000000]

. gen water=0

.
. gen liquids=0

.
. gen milk=0

.
. gen solids=0

.
. gen breast=0

.
. gen bottle=0

. replace water=1 if (v409>=1 & v409<=7)

. replace liquids=1 if v409a>=1 & v409a<=7

.
. replace liquids=1 if v410>=1 & v410<=7

.
. replace liquids=1 if v410>=1 & v410<=7

. replace liquids=1 if v410a>=1 & v410a<=7

. replace liquids=1 if v413>=1 & v413<=7

. replace liquids=1 if v413a>=1 & v413a<=7

. replace liquids=1 if v413b>=1 & v413b<=7

. replace liquids=1 if v413c>=1 & v413c<=7

. replace liquids=1 if v413d>=1 & v413d<=7

. capture replace liquids=1 if v412c>=1 & v412c<=7

. replace milk=1 if v411>=1 & v411<=7

.
. replace milk=1 if v411a>=1 & v411a<=7

.
. replace milk=1 if v412>=1 & v412<=7

.
. replace milk=1 if v414p>=1 & v414p<=7

. replace breast=1 if m4==95

. replace bottle=1 if m38==1

. replace solids=1 if v414a>=1 & v414a<=7

. replace solids=1 if v414b>=1 & v414b<=7

. replace solids=1 if v414c>=1 & v414c<=7

. replace solids=1 if v414d>=1 & v414d<=7

. replace solids=1 if v414e>=1 & v414e<=7

. replace solids=1 if v414f>=1 & v414f<=7
. replace solids=1 if v414h>=1 & v414h<=7

. replace solids=1 if v414g>=1 & v414g<=7

. replace solids=1 if v414i>=1 & v414i<=7

. replace solids=1 if v414j>=1 & v414j<=7

. replace solids=1 if v414k>=1 & v414k<=7

. replace solids=1 if v414l>=1 & v414l<=7
. replace solids=1 if v414m>=1 & v414m<=7

. replace solids=1 if v414n>=1 & v414n<=7

. replace solids=1 if v414o>=1 & v414o<=7

. replace solids=1 if v414p>=1 & v414p<=7

. replace solids=1 if v414q>=1 & v414q<=7
. replace solids=1 if v414r>=1 & v414r<=7

. replace solids=1 if v414s>=1 & v414s<=7
. replace solids=1 if v414t>=1 & v414t<=7
. replace solids=1 if v414u>=1 & v414u<=7
. replace solids=1 if v412a==1 | v412b==1
. gen diet=7

. replace diet=0 if water==0 & liquids==0 & milk==0 & solids==0

.
. replace diet=1 if water==1 & liquids==0 & milk==0 & solids==0

.
. replace diet=2 if liquids==1 & milk==0 & solids==0

.
. replace diet=3 if milk==1 & solids==0

.
. replace diet=4 if milk==0 & solids==1

.
. replace diet=5 if milk==1 & solids==1

.
. replace diet=6 if breast==0

ta diet if age<6 [iw=v005/1000000]

. gen ebf=0

. replace ebf=1 if diet==0

. ta ebf if age<6 [iw=v005/1000000]

. * generate age groupings
recode age (0/5 = 0 "0-5")(6/8 = 1 "6-8")(9/11 = 2 "9-11")(12/17 = 3 "12-17")(18/23 = 4 "18-23"), gen(ageg2)
lab var ageg2 "Age groups"
tab ageg2

generate age groupings
recode age (0/1 = 0 "0-1")(2/3 = 1 "2-3")(4/5 = 2 "4-5")(6/11 = 3 "6-11")(12/23 = 4 "12-23"), gen(ageg5)
lab var ageg5 "Age groups2"
tab ageg5

tabulate exclusive breastfeeding status by age group
tab ageg2 ebf [iw=v005/1000000]
tab ageg2 ebf
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 "+complementary"
label var feeding feeding

ta feeding if age<6 [iw=v005/1000000]

/*complimentary feeding is category #5 (+solids) and this matches the report for this age group which is 19.1%*/
ta feeding if age<6 [iw=v005/1000000]
tab ageg2 feeding [iw=v005/1000000]
/*creating the complementary feeding variable*/
recode feeding (0 1 2 3 4=0) (5=1), gen(comp)
tab ageg2 comp [iw=v005/1000000]

/*creating the missing variable*/
recode feeding (1 2 3 4 5=0) (0=1), gen(miss)
tab ageg2 miss [iw=v005/1000000]
ta miss if age<6 [iw=v005/1000000]

/*creating the predominant breastfeeding variable*/
recode feeding (0 4 5=0) (1/3=1), gen(predom)

/*this matches the report of 77.5% for predominant breastfeeding*/
ta predom if age<6 [iw=v005/1000000]

tab ageg2 predom [iw=v005/1000000]

*creating the predominant breastfeeding variable.
recode feeding (0 1 4 5=0) (2 3=1), gen(predom2)

tab ageg2 predom2 [iw=v005/1000000]
ta predom2 if age<6 [iw=v005/1000000]

/*bottlefeeding*/
ta bottle if age<6 [iw=v005/1000000]

tab ageg2 bottle [iw=v005/1000000]

ta bottle if age<24 [iw=v005/1000000]

/*Early initiation of breastfeeding within an hour 0-23 months*/
ta m34 if age<24 [iw=v005/1000000]

or
ta v426 if age<24 [iw=v005/1000000]

* generate age groupings
recode age (0/11 = 0 "0-11")(12/23 = 1 "12-23"), gen(ageg3)
lab var ageg3 "Age groups"

tabulate early initiation of breastfeeding status by age group
recode m34 (100= 1 "immediately")(1 199 200= 2 "hours")(1 999 .= 3 "days"), gen(earlyinit)
lab var earlyinit "EIBF"
tab earlyinit
tab ageg3 earlyinit [iw=v005/1000000]

tab ageg5 initiat [iw=v005/1000000]

recode earlyinit (1=1 "yes") (2 3 101 201=0 "No"),gen(initiat)
lab var initiat "EIBF"
tab initiat
tab ageg3 initiat [iw=v005/1000000]

Regards,

Rose Calculating cases for IYCF By: anuth on Wed, 26 October 2016 14:05 Re: Calculating cases for IYCF By: Trevor-DHS on Wed, 26 October 2016 18:12 Re: Calculating cases for IYCF By: Roselync on Fri, 16 December 2016 02:51 Re: Calculating cases for IYCF By: Bridgette-DHS on Mon, 19 December 2016 08:49 Re: Calculating cases for IYCF By: Roselync on Mon, 19 December 2016 09:43 Re: Calculating cases for IYCF By: Roselync on Fri, 06 January 2017 04:34 Re: Calculating cases for IYCF By: Roselync on Sun, 08 January 2017 09:34 Re: Calculating cases for IYCF By: Bridgette-DHS on Mon, 09 January 2017 09:04 Re: Calculating cases for IYCF By: Roselync on Mon, 09 January 2017 09:19 Re: Calculating cases for IYCF By: Bridgette-DHS on Tue, 10 January 2017 08:55 Re: Calculating cases for IYCF By: Roselync on Tue, 10 January 2017 09:06 Re: Calculating cases for IYCF By: adenikedegun on Wed, 21 June 2017 05:58 Re: Calculating cases for IYCF By: Bridgette-DHS on Wed, 21 June 2017 08:36 Re: Calculating cases for IYCF By: adenikedegun on Wed, 21 June 2017 18:03 Re: Calculating cases for IYCF By: adenikedegun on Thu, 22 June 2017 08:59 Re: Calculating cases for IYCF By: Bridgette-DHS on Thu, 22 June 2017 09:55 Re: Calculating cases for IYCF By: Bridgette-DHS on Thu, 22 June 2017 10:10 Re: Calculating cases for IYCF By: adenikedegun on Thu, 22 June 2017 11:06 Re: Calculating cases for IYCF By: adenikedegun on Thu, 22 June 2017 11:15 Re: Calculating cases for IYCF By: Bridgette-DHS on Thu, 22 June 2017 14:50 Re: Calculating cases for IYCF By: adenikedegun on Thu, 22 June 2017 10:42 Re: Calculating cases for IYCF By: adenikedegun on Tue, 27 June 2017 08:09 Re: Calculating cases for IYCF By: Bridgette-DHS on Tue, 27 June 2017 10:20 Re: Calculating cases for IYCF By: adenikedegun on Tue, 27 June 2017 15:41 Re: Calculating cases for IYCF By: Roselync on Wed, 23 May 2018 00:53 Re: Calculating cases for IYCF By: Bridgette-DHS on Wed, 23 May 2018 09:24 Re: Calculating cases for IYCF By: Roselync on Wed, 23 May 2018 19:48 Re: Calculating cases for IYCF By: Mlue on Thu, 24 May 2018 04:48 Re: Calculating cases for IYCF By: Hassen on Thu, 24 May 2018 05:25 Re: Calculating cases for IYCF By: Roselync on Thu, 24 May 2018 06:53 Re: Calculating cases for IYCF By: Roselync on Sun, 27 May 2018 06:31 Re: Calculating cases for IYCF By: Mlue on Mon, 28 May 2018 02:28 Re: Calculating cases for IYCF By: Roselync on Mon, 28 May 2018 02:51 Re: Calculating cases for IYCF By: Mlue on Mon, 28 May 2018 04:44 Re: Calculating cases for IYCF By: Roselync on Mon, 28 May 2018 04:51 Re: Calculating cases for IYCF By: Hassen on Wed, 06 June 2018 11:07 Re: Calculating cases for IYCF By: Hope on Wed, 13 June 2018 02:50 Re: Calculating cases for IYCF By: Bridgette-DHS on Fri, 15 June 2018 06:10 Re: Calculating cases for IYCF By: Hope on Mon, 18 June 2018 12:25 Re: Calculating cases for IYCF By: Chris on Sun, 10 February 2019 10:01 Re: Calculating cases for IYCF By: Roselync on Thu, 06 April 2017 07:32 Re: Calculating cases for IYCF By: Bridgette-DHS on Thu, 06 April 2017 14:33 Re: Calculating cases for IYCF By: Roselync on Fri, 07 April 2017 11:01 Re: Calculating cases for IYCF By: Sajhama on Wed, 25 October 2017 14:14 Re: Calculating cases for IYCF By: Bridgette-DHS on Thu, 26 October 2017 13:13 Re: Calculating cases for IYCF By: Sajhama on Thu, 26 October 2017 14:56 Re: Calculating cases for IYCF By: Chris on Tue, 10 April 2018 13:18 Re: Calculating cases for IYCF By: Trevor-DHS on Tue, 10 April 2018 17:31 Re: Calculating cases for IYCF By: Chris on Wed, 11 April 2018 12:24 Re: Calculating cases for IYCF By: Chris on Fri, 13 April 2018 01:32
 Previous Topic: Selecting one child per mother Next Topic: Postnatal care utilization variable in 2015-2016 MDHS dataset
Goto Forum:

Current Time: Sat Jan 22 00:42:10 Coordinated Universal Time 2022