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 Go to previous messageGo to previous message
Roselync is currently offline  Roselync
Messages: 19
Registered: 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


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Selecting one child per mother
Next Topic: Postnatal care utilization variable in 2015-2016 MDHS dataset
Goto Forum:
  


Current Time: Tue Mar 19 00:07:45 Coordinated Universal Time 2024