Home » Data » Dataset use in SPSS » Calculating cases for IYCF
Re: Calculating cases for IYCF [message #15045 is a reply to message #15044] |
Mon, 28 May 2018 04:44 |
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;
|
|
|
|
|
Calculating cases for IYCF
By: anuth on Wed, 26 October 2016 14:05
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Fri, 16 December 2016 02:51
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Mon, 19 December 2016 09:43
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Fri, 06 January 2017 04:34
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Sun, 08 January 2017 09:34
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Mon, 09 January 2017 09:19
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Tue, 10 January 2017 09:06
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Mlue on Thu, 24 May 2018 04:48
|
|
|
Re: Calculating cases for IYCF
By: Hassen on Thu, 24 May 2018 05:25
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Mlue on Mon, 28 May 2018 02:28
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Mlue on Mon, 28 May 2018 04:44
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Hassen on Wed, 06 June 2018 11:07
|
|
|
Re: Calculating cases for IYCF
By: Hope on Wed, 13 June 2018 02:50
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Hope on Mon, 18 June 2018 12:25
|
|
|
Re: Calculating cases for IYCF
By: Chris on Sun, 10 February 2019 10:01
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Thu, 06 April 2017 07:32
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Roselync on Fri, 07 April 2017 11:01
|
|
|
Re: Calculating cases for IYCF
By: Sajhama on Wed, 25 October 2017 14:14
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Sajhama on Thu, 26 October 2017 14:56
|
|
|
Re: Calculating cases for IYCF
By: Chris on Tue, 10 April 2018 13:18
|
|
|
Re: Calculating cases for IYCF
|
|
|
Re: Calculating cases for IYCF
By: Chris on Wed, 11 April 2018 12:24
|
|
|
Re: Calculating cases for IYCF
By: Chris on Fri, 13 April 2018 01:32
|
Goto Forum:
Current Time: Thu Dec 26 12:27:55 Coordinated Universal Time 2024
|