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 #15038 is a reply to message #14987] Sun, 27 May 2018 06:31 Go to previous messageGo to next message
Roselync is currently offline  Roselync
Messages: 19
Registered: December 2016
Location: Taiwan
Member
Hie Mluleki,
I managed to calculate the breastfeeding practices (early initiation of breastfeeding, exclusive breastfeeding) using the syntax that you gave me. However, am faced with the challenge of calculating bottle feeding. I tried applying the syntax for bottle feeding using the two separate data files but it still doesn't match that of the report. Any suggestions on how I can go about it?. Below is the syntax that I used:

svy: tab bottle2 if age<6, count percent format(%4.0f) col...then I tried the other one:

svy: tab child_age_grp bottle2, count format(%4.0f)
svy: tab child_age_grp bottle2, percent format(%4.1f) row

Your assistance will be highly appreciated

Regards,
Rose
Re: Calculating cases for IYCF [message #15043 is a reply to message #15038] Mon, 28 May 2018 02:28 Go to previous messageGo to next message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hi,

Please tell me which table are you trying to replicate?
Re: Calculating cases for IYCF [message #15044 is a reply to message #15043] Mon, 28 May 2018 02:51 Go to previous messageGo to next message
Roselync is currently offline  Roselync
Messages: 19
Registered: December 2016
Location: Taiwan
Member
Hie,
I am trying to replicate table 11.3 (percentage using a bottle with a nipple)

Thanks,

Rose
Re: Calculating cases for IYCF [message #15045 is a reply to message #15044] Mon, 28 May 2018 04:44 Go to previous messageGo to next message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hi,

See the following:

For Stata

/*
	USE THE CHILDREN'S RECODE: MWKR7HFL
	Malawi: Standard DHS, 2015-16
	
*/

clear all
set matsize 800
set maxvar 10000
set mem 1g
cd "..."
use "MWKR7HFL", clear
set more off

********************************************************************************

** WEIGHT VARIABLE
gen weight = v005/1000000

********************************************************************************

** SURVEY SET
gen psu =    v021
gen strata = v023
svyset psu [pw = weight], strata(strata) vce(linearized)

********************************************************************************

// RENAME

rename v013 age_woman
rename v106 education
rename v190 wealth
rename v025 residence
rename v024 region

////////////////////////////////////////////////////////////////////////////////

// GENERATING DEPENDENT VARIABLES

gen child_age=b19

recode child_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") (else=.), gen(child_age_grp)
svy: tab child_age_grp, count format(%4.0f)

*keep if child_age_grp !=.

* keep only children less than 2 years 
keep if child_age<24 & b5==1

*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*

* IF WAS EVER BOTTLE FED
gen bottle=0
replace bottle=1 if m38==1
label define bottle 0"No" 1"Yes"
label var bottle "Percentage using a bottle with a nipple?."
label val bottle bottle

gen bottle2=0
replace bottle2 = 1 if m38==1 & inrange(m4,93,99)
replace bottle2 = 0 if (m38==0 & m38==9) & inrange(m4,93,99)
label define bottle2 0"No" 1"Yes"
label var bottle2 "Percentage using a bottle with a nipple?"
label val bottle2 bottle2


**********************************************

*** DELIVERY
cap drop place_delivery
recode m15 (21/36=1 "Health facility") (11/12=2 "At home") ///
(else=3 "Other/Missing"), gen(place_delivery)
label var place_delivery "Place of delivery"
label val place_delivery place_delivery

** SKILLED BIRTH ATTENDANT
cap drop skilled_birth
gen skilled_birth	=	3
replace skilled_birth = 1 if (m3a==1 | m3b==1)
replace skilled_birth = 2 if m3g==1 & (m3b!=1)
replace skilled_birth = 4 if m3n==1
label define skilled_birth	1"Health professional" 2"Traditional birth attendant" ///
							3"Other" 4"No one"
label var skilled_birth "Birth delivered by skilled birth attendant"
label val skilled_birth skilled_birth

*==============================================================================*

** DROP IF NOT WITHIN SAMPLE
qui regr bottle if v208 !=0 [pw=weight]		
drop if e(sample)!=1

********************************************************************************

** CHECK: Table 11.3 Percentage using a bottle with a nipple as on the report
svy: tab child_age_grp bottle, count format(%4.0f)
svy: tab child_age_grp bottle, percent format(%4.1f) row

*==============================================================================*

exit


************************************************************ ********************

For SPSS

GET
  STATA FILE='...\MWKR7HFL.DTA'.
DATASET NAME DataSet2 WINDOW=FRONT.

****************************************************************************************************************************************************.
COMPUTE weight = v005/1000000.
COMPUTE strata = v023.
COMPUTE psu = v021.

WEIGHT BY weight.

***++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++***.
COMPUTE child_age = b19.

SELECT IF child_age <24 AND B5=1.

RECODE child_age   (0,1 = 1) (2,3 = 2) (4,5=3) (6,7,8=4) (9 thru 11 = 5) (12 thru 17=6) 
                               (18 thru 23=7) INTO child_age_grp.
VARIABLE LABELS child_age_grpge "Age of child in months".
VALUE LABELS child_age_grp 1"0-1" 2"2-3" 3"4-5" 4"6-8" 5"9-11" 6"12-17" 7"18-23".

****************************************************************************************************************************************************.

/** IF CHILD WAS EVER BOTTLE FED **/.
COMPUTE bottle = 0.
   IF M38=1 bottle = 1.
EXECUTE.
VALUE LABELS bottle 0 "No" 1 "Yes".
VARIABLE LABELS bottle "Percentage using a bottle with a nipple?".

/** DELIVERY CARE **/.
RECODE M15 (21 THRU 36=1) (11 THRU 12=2) (ELSE=3) INTO place_delivery.
VALUE LABELS place_delivery 1 "Health facility" 2 "At home" 3 "Other/Missing".
VARIABLE LABELS place_delivery "Place of delivery".

/** SKILLED BIRTH ATTENDANT **/.
COMPUTE skilled_birth=3.
IF m3a=1 OR m3b=1		skilled_birth=1.
IF m3g=1 AND m3b NE 1	skilled_birth=2.
IF m3n=1				skilled_birth=4.
VALUE LABELS skilled_birth 1 "Health professional" 2 "Traditional birth attendant" 3 "Other" 4 "No one".
VARIABLE LABELS skilled_birth "Type of attendant at birth".


// CHECK //.

* Analysis Preparation Wizard.
CSPLAN ANALYSIS
  /PLAN FILE='...\Malawi.csaplan'
  /PLANVARS ANALYSISWEIGHT=weight
  /SRSESTIMATOR TYPE=WOR
  /PRINT PLAN
  /DESIGN STRATA=strata CLUSTER=psu
  /ESTIMATOR TYPE=WR.

*********************************************************.
* Complex Samples Crosstabs.
CSTABULATE
  /PLAN FILE='...\Malawi.csaplan'
  /TABLES VARIABLES=child_age_grp BY bottle
  /CELLS POPSIZE
  /STATISTICS SE
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

*********************************************************.

CROSSTABS
  /TABLES=child_age_grp BY bottle
  /FORMAT=AVALUE TABLES
  /CELLS=ROW
  /COUNT ROUND CELL.

/*
CROSSTABS
  /TABLES=child_age_grp BY bottle
  /FORMAT=AVALUE TABLES
  /CELLS=COUNT
  /COUNT ROUND CELL.

/*
FREQUENCIES VARIABLES=bottle place_delivery skilled_birth child_age_grp child_age
  /ORDER=ANALYSIS.


************************************************************ ********************

For SAS


/*
	IMPORT THE CHILDREN'S RECODE (Stata file): MWKR7HFL
	Malawi: Standard DHS, 2015-16
	
*/

PROC IMPORT DATAFILE="...\MWKR7HFL"
	DBMS=DTA
	OUT=WORK.MALAWI_DHS_15
	REPLACE;
RUN;

DATA BOTTLE_FEEDING;
	SET WORK.MALAWI_DHS_15;

	weight	=	(v005/1000000);
	strata	=	v023;
	psu		=	v021;

	child_age	=	b19;

	IF child_age <24 & b5=1;

	FORMAT BOTTLE $6. place_delivery $17. skilled_birth $30.;

	/** CHILD AGE GROUPS IN MONTHS **/
	IF child_age in(0:1)	THEN	child_age_grp = "00-01";
	IF child_age in(2:3)	THEN	child_age_grp = "02-03";
	IF child_age in(4:5)	THEN	child_age_grp = "04-05";
	IF child_age in(6:8)	THEN	child_age_grp = "06-08";
	IF child_age in(9:11)	THEN	child_age_grp = "09-11";
	IF child_age in(12:17)	THEN	child_age_grp = "12-17";
	IF child_age in(18:23)	THEN	child_age_grp = "18-23";
	*IF child_age not in(0:23)	THEN	child_age_grp = .;
	LABEL child_age_grp = "Age group of child in months";

	/** IF CHILD WAS EVER BOTTLE FED **/
	IF m38 in(1)			THEN	bottle="1. Yes";
	IF m38 not in(1)		THEN	bottle="0. No";
	LABEL bottle = "Percentage using a bottle with a nipple?";

	/** DELIVERY CARE **/
	IF M15 in(21:36)			THEN	place_delivery="1. Health facility";
	IF M15 in(11:12)			THEN	place_delivery="2. At home";
	IF M15 not in(11:12,21:36)	THEN	place_delivery="3. Other/Missing";
	LABEL place_delivery = "Place of delivery";

	/** SKILLED BIRTH ATTENDANT **/
	*IF	m3a = 1	OR	m3b = 1	= 	1	THEN	skilled = 1; *else 
	*IF	m3a 	OR	m3b		NE	1	THEN	skilled = 0;

	skilled_birth1=3;
	IF m3a=1 OR m3b=1		THEN	skilled_birth1=1;
	IF m3g=1 AND m3b NE 1	THEN	skilled_birth1=2;
	IF m3n=1				THEN	skilled_birth1=4;

	IF skilled_birth1=1		THEN	skilled_birth="1. Health professional";
	IF skilled_birth1=2		THEN	skilled_birth="2. Traditional birth attendant";
	IF skilled_birth1=3		THEN	skilled_birth="3. Other";
	IF skilled_birth1=4		THEN	skilled_birth="4. No one";
	LABEL skilled_birth = "Type of attendant at birth";

	PROC TEMPLATE;
		EDIT BASE.FREQ.CROSSTABFREQS;
		EDIT FREQUENCY;
		FORMAT=BEST12.;
		END;
		END;
RUN;

PROC FREQ DATA=WORK.BOTTLE_FEEDING;
	WEIGHT weight;
	*TABLE bottle place_delivery skilled_birth1 skilled_birth;
	TABLE child_age_grp * bottle	/NOCOL NOROW NOPERCENT;
RUN;

Re: Calculating cases for IYCF [message #15046 is a reply to message #15045] Mon, 28 May 2018 04:51 Go to previous messageGo to next message
Roselync is currently offline  Roselync
Messages: 19
Registered: December 2016
Location: Taiwan
Member
Hie,
Thank you so much. Let me try running the syntax now

Regards,

Rose
Re: Calculating cases for IYCF [message #15124 is a reply to message #15046] Wed, 06 June 2018 11:07 Go to previous messageGo to next message
Hassen
Messages: 121
Registered: April 2018
Location: Ethiopia,Africa
Senior Member
Dear Mlue,Thank you very much!!
With Best Wishes,Hassen


Hassen Ali(Chief Public Health Professional Specialist)
Re: Calculating cases for IYCF [message #15172 is a reply to message #15124] Wed, 13 June 2018 02:50 Go to previous messageGo to next message
Hope
Messages: 9
Registered: April 2018
Member
Hello,

I am trying to replicate Table 11.3 in the Rwanda DHS 2014-2015. I have followed the SPSS syntax given in this thread, however, I did not get the exact result like in the report. Some percentages differ.
When I look at my output table (attached here), I realized I do not have the first column of 'not breastfeeding' as in the report. I know that first column includes missing values also, can you please help me to know where I am getting it wrong? And also how do I take into account missing values in the SPSS syntax?

Thanks,
Hope
Re: Calculating cases for IYCF [message #15198 is a reply to message #15172] Fri, 15 June 2018 06:10 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3190
Registered: February 2013
Senior Member
Following is a response from Senior Data Processing Specialist, Ladys Ortiz:

The main difficulty with this table is identifying the last child living with the mother. There are very few cases where the youngest child under age 2 is not leaving with their mother. Those few cases are the ones preventing you to match your number with table 11.3. If the youngest child (MIDX=1) is not leaving with the mother or is not alive, we should check if the next to last child (MIDX=2) is alive and living with the mother and so on.

I'm attaching the SPSS syntax and the output for table 11.3 (the % using bottle with nipple is not included in this syntax).
These are the steps I follow to identify the last child alive and living with the mother:

a) I used the women data file (IR) identify the last child living with the mother
b) I create a small data file with the mother id variables + the flag variable
c) I merge the file in point b) with the children data file (KR).
d) Select children alive and age = 0-23 month
e) Create my variables and do table
Re: Calculating cases for IYCF [message #15230 is a reply to message #15198] Mon, 18 June 2018 12:25 Go to previous messageGo to next message
Hope
Messages: 9
Registered: April 2018
Member
Dear Bridgette & Ladys,

Thank you so much for your feedback.
I see I didn't know I should pay attention to the MIDX variable.
I am going to follow the steps and I will let you know if I come up with the correct results.

Thanks,
Hope
Re: Calculating cases for IYCF [message #16639 is a reply to message #15230] Sun, 10 February 2019 10:01 Go to previous message
Chris is currently offline  Chris
Messages: 6
Registered: April 2018
Member
Dear DHS team,
I am working on the 20152016 Malawi Demographic and Health Survey dataset using SPSS. I would like to estimate the percentage of women who received a postnatal check during the first 2 days after birth (among women aged 15-49 who gave birth in the 2 years before the survey).
I have selected (b19 < 24) to restrict my analysis to women who gave birth in the last two years before the survey but my results didn't match those that are in the 2015-2016 report. I found that 43.4% of women who gave birth in the last two years had a postnatal check during the first 2 days instead of 42.4% which is in the report. Is it that the figure in the report is not correct or my calculations are wrong?
Please also help me on how to manage missing values in this variable? I am trying to replicate the results on column 10 in the table 9.9 in the report.
Any suggestions will be greatly appreciated. Thank you
Previous Topic: Selecting one child per mother
Next Topic: Postnatal care utilization variable in 2015-2016 MDHS dataset
Goto Forum:
  


Current Time: Fri Nov 8 22:00:13 Coordinated Universal Time 2024