The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in SPSS » Indonesia 2017 data set (m4: duration of breastfeeding)
Re: Indonesia 2017 data set [message #17933 is a reply to message #17871] Fri, 19 July 2019 07:23 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 2548
Registered: February 2013
Senior Member
Following is a response from DHS Lead Nutrition Research Associate, Rukundo Benedict:

I re-ran the data and I get what is in the report. Below is the code I used to get my results.

use "C:\Users\39788\ICF\Analysis - Shared Resources\Data\DHSdata\IDKR71FL.DTA" 

*Generate weight variable**
gen wgt=v005/1000000
*Generate age, keep those <2 years
gen age=b19
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)
**If drank from bottle with nipple (bottlefeeding)
gen bottle=0
replace bottle=1 if m38==1 
ta age_month bottle  [iw=wgt], row
*Important Note: for the other indicators, 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, jiuce, 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

*CBF at 1 year
gen CBFage=0
replace CBFage=1 if age>11 & age<16
ta CBFage
ta breast CBFage
ta CBFage breast [iw=wgt], row
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multilevel analysis
Next Topic: Complex Samples
Goto Forum:

Current Time: Wed Aug 10 17:11:18 Coordinated Universal Time 2022