The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Reproductive Health » MOTHER POSTNATAL CARE ON SPSS (EXAMPLE OF MALAWI)
MOTHER POSTNATAL CARE ON SPSS [message #16786] Mon, 04 March 2019 08:56 Go to previous message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
This code reproduces mother PNC using SPSS.
I used Malawi DHS 2015-16 as an example.

** I USED A STATA FILE HERE **.
GET
  STATA FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MWIR7HFL.dta'.
DATASET NAME DataSet1 WINDOW=FRONT.

********************************************.
** GENERATE THE WEIGHT VARIABLE & WEIGHT DATA **.
COMPUTE weight = V005/1000000.

WEIGHT BY weight.

********************************************.
** COMPLEX SURVEY VARIABLES **.
COMPUTE psu = V021.
COMPUTE strata = V023.

********************************************.
** RENAME A FEW VARIABLES TO BE USE IN ANALYSIS **.
RENAME VARIABLES (V013 = age) (V149 = education) (V190 = wealth) (V025 = residence) (V024 = region).

********************************************.
*generate variable for birth in the last two years.
COMPUTE birth2=0.
   IF (b19_01 LT 24)  birth2 = 1.
EXECUTE.

********************************************.
* PNC TIMING FOR THE MOTHER		.
COMPUTE momcheck=0.
   IF (M62_1 EQ 1 OR M66_1 EQ 1)  AND birth2 EQ 1 momcheck = 1.
EXECUTE.

COMPUTE pnc_wm_time=$SYSMIS.
   IF (birth2 EQ 1 AND momcheck EQ 1) pnc_wm_time = 999.
   IF RANGE(m64_1,11,29) AND birth2 EQ 1 pnc_wm_time = m63_1.
   IF pnc_wm_time EQ 999 AND RANGE(m68_1,11,29) AND birth2 EQ 1 pnc_wm_time = m67_1.
   IF momcheck EQ 0 AND birth2 EQ 1 pnc_wm_time = 0.
EXECUTE.

RECODE pnc_wm_time   (100 THRU 103 = 1) (104 THRU 123 200 = 2) (124 THRU 171 201 202 = 3) 
                                     (172 THRU 197 203 THRU 206 = 4) (207 THRU 241 300 THRU 305 = 5) 
                                      (998=6) (ELSE=7) INTO rh_pnc_wm_timing.
VALUE LABELS rh_pnc_wm_timing 1 "<4 hours" 2 "4-23 hours" 3"1-2 days" 4 "3-6 days" 5 "7-41 days" 6 "Don't know" 7 "No check".
VARIABLE LABELS rh_pnc_wm_timing "Timing of first postnatal check-up for the mother".
EXECUTE.

RENAME VARIABLES (rh_pnc_wm_timing = PNC_mother).

********************************************.
	
RECODE PNC_mother   (1 THRU 3 = 1) (ELSE=0) INTO PNC_mother2days.
VALUE LABELS PNC_mother2days 0"Not in 2 days" 1 "Within 2 days".
VARIABLE LABELS PNC_mother2days "Percentage of women with a postnatal check during the first 2 days after birth".
EXECUTE.

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

SELECT IF pnc_wm_time LE 1000.

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

* Analysis Preparation Wizard.
CSPLAN ANALYSIS
  /PLAN FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MAMAWIDHS2015_16_CSPLAN.csaplan'
  /PLANVARS ANALYSISWEIGHT=weight
  /SRSESTIMATOR TYPE=WOR
  /PRINT PLAN
  /DESIGN STRATA=strata CLUSTER=psu
  /ESTIMATOR TYPE=WR.

********************************************************************************************.
 /** CHECK **/.

* complex Samples Frequencies.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MAMAWIDHS2015_16_CSPLAN.csaplan'
  /TABLES VARIABLES=PNC_mother PNC_mother2days
  /CELLS POPSIZE TABLEPCT
  /STATISTICS DEFF
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

****************************.
** CROSSTABS **.

* complex Samples Crosstabs.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MAMAWIDHS2015_16_CSPLAN.csaplan'
  /TABLES VARIABLES=wealth BY PNC_mother
  /CELLS ROWPCT
  /STATISTICS CV
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

* complex Samples Crosstabs.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MAMAWIDHS2015_16_CSPLAN.csaplan'
  /TABLES VARIABLES=wealth BY PNC_mother2days
  /CELLS ROWPCT
  /STATISTICS CV
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

****************************.
/* MAY NOT GET EXACT SAME RESULTS AS IN THE REPORT */.
FREQUENCIES VARIABLES=PNC_mother PNC_mother2days
  /ORDER=ANALYSIS.

CROSSTABS
  /TABLES=wealth BY PNC_mother PNC_mother2days
  /FORMAT=AVALUE TABLES
  /CELLS=ROW
  /COUNT ROUND CELL.
 
Read Message
Read Message
Read Message
Previous Topic: Infertility as a composite variable
Next Topic: decomposition and multi-level analysis
Goto Forum:
  


Current Time: Wed Dec 4 21:14:31 Coordinated Universal Time 2024