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
 Bridgette-DHS Messages: 1959Registered: 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
```

 Indonesia 2017 data set By: Hai R on Thu, 02 May 2019 02:20 Re: Indonesia 2017 data set By: Bridgette-DHS on Thu, 02 May 2019 08:25 Re: Indonesia 2017 data set By: Hai R on Mon, 06 May 2019 19:58 Re: Indonesia 2017 data set By: Hai R on Sun, 30 June 2019 22:16 Re: Indonesia 2017 data set By: Bridgette-DHS on Fri, 19 July 2019 07:23 Re: Indonesia 2017 data set By: lhuri on Wed, 07 August 2019 11:32 Re: Indonesia 2017 data set By: Bridgette-DHS on Sat, 17 August 2019 14:21 Re: Indonesia 2017 data set By: lhuri on Thu, 22 August 2019 08:43 Re: Indonesia 2017 data set By: Hai R on Sat, 20 July 2019 01:27 Re: Indonesia 2017 data set By: lmallick on Fri, 27 September 2019 09:19 Re: Indonesia 2017 data set By: lhuri on Tue, 15 October 2019 11:49
 Previous Topic: Multilevel analysis Next Topic: Complex Samples
Goto Forum:

Current Time: Tue Oct 20 04:57:09 Eastern Daylight Time 2020