The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Nepal » Breastfeeding
Re: Breastfeeding [message #13215 is a reply to message #13213] Thu, 05 October 2017 16:57 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 721
Registered: January 2013
Senior Member
You don't need B9 - this is all last born children irrespective of whether they live with their mother or not, or even if they are dead - See the footnote to the table. I'm matching exactly with the following code:
cd "C:\Data\DHS_SPSS".
get file="NPKR60FL.SAV".

* Last child born in the last 2 years.
* age in months.
compute age = v008-b3.
variable labels age "Age in months".
* keep if under 24 months and are the last child.
select if age<24 & bidx=1.

compute wt=v005/1000000.
weight by wt.
freq m4.

M4 Duration of breastfeeding     
                                                     Frequency    Percent Valid Percent Cumulative Percent
Valid 93 Ever breastfed, not currently breastfeeding        95        4.7           4.7           4.7
      94 Never breastfed                                    37        1.8           1.8           6.5
      95 Still breastfeeding                              1898       93.5          93.5         100.0
      Total                                               2030      100.0         100.0
Ever breastfed, but not currently (95) plus still breastfeeding (1898) = 1993 as in the table.

However, if you want to restrict to youngest child under two years living with their mother, as in table 11.3, you would need code like the following:
get file="NPKR60FL.SAV".

* Cases should be sorted already, but in case they are not.
sort cases by caseid bidx.
* Last child in the last 2 years living with mother.
* age in months.
compute age = v008-b3.
variable labels age "Age in months".
* keep if under 24 months and living with mother.
select if age<24 & b9=0.
* ... and keep the last born of those. If caseid is the same as the prior case, then not the last born.
select if caseid <> lag(caseid).
* generate variable for still breastfeeding.
recode m4 (95=1)(else=0) into bf.
variable labels bf "Currently breastfeeding".
value labels bf 1  "Still breastfeeding" 0  "Not breastfeeding".
print formats bf (f1.0).

* generate age groupings.
recode age (0 thru 1 = 0)(2 thru 3 = 1)(4 thru 5 = 2)(6 thru 8 = 3)(9 thru 11 = 4)(12 thru 17 = 5)(18 thru 23 = 6) into ageg.
variable labels ageg "Age groups".
value labels ageg 0 "0-1" 1 "2-3" 2 "4-5" 3 "6-8" 4 "9-11" 5 "12-17" 6 "18-23".
print formats ageg (f1.0).

* tabulate current breastfeeding status by age group.
compute wt=v005/1000000.
weight by wt.
crosstabs tables=ageg by bf /cells=count row /count=asis.

 
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: DHS Nepal 2016 Do files
Next Topic: pregnancy interval in months variable
Goto Forum:
  


Current Time: Thu Sep 24 11:33:16 Eastern Daylight Time 2020