Re: prelacteal feed [message #16658 is a reply to message #16655] |
Wed, 13 February 2019 06:06 |
Mlue
Messages: 92 Registered: February 2017 Location: North West
|
Senior Member |
|
|
Hello,
The following program could send you in the right direction.
LIBNAME A "\\H123456789\Users\User1\Documents\EGYPT DHS 2014\EDHS2014_SAS";
DATA WORK.EDHS_FEEDING;
SET A.EGKR61FL;
weight = (V005 / 1000000);
psu = V021;
strata = V023;
/** CHILD'S AGE IN MONTHS **/
child_age=(V008-B3);
IF child_age < 24;
/* REMOVING SCIENTIFIC NOTATION FROM RESULTS OUTPUT */
PROC TEMPLATE;
EDIT BASE.FREQ.CROSSTABFREQS;
EDIT FREQUENCY;
FORMAT=BEST12.;
END;
END;
RUN;
/** FINDING THE YOUNGEST CHILD USING BIDX **/
PROC SORT DATA=WORK.EDHS_FEEDING;
BY V001 V002 V003;
RUN;
PROC SQL;
TITLE 'MINIMUM BIDX OR YOUNGEST CHILD';
CREATE TABLE WORK.bidx_query AS
SELECT V001,V002,V003,BIDX,M4,M38, MIN(BIDX) AS MINBIDX format=COMMA16.
FROM WORK.EDHS_FEEDING
GROUP BY V001,V002,V003
ORDER BY V001,V002,V003;
RUN;
/* MERGING */
PROC SORT DATA=WORK.bidx_query;
BY V001 V002 V003;
RUN;
PROC SORT DATA=WORK.EDHS_FEEDING;
BY V001 V002 V003;
RUN;
/** MERGING/COMBINING THE DATA FILES **/
DATA WORK.EDHS_MERGED;
MERGE WORK.EDHS_FEEDING (IN=x) WORK.bidx_query (IN=y);
BY V001 V002 V003;
RUN;
/*********************************************************************************/
/** START HERE **/
DATA WORK.EDHS_BF;
SET WORK.EDHS_MERGED;
IF (BIDX <= MINBIDX);
FORMAT child_age_grp$5. place_delivery$18. WITHIN_HOUR $6. WITHIN_ONE_DAY $6. ever_breastfed$6. prelacteal$6. age_at_birth $8. birth_order $7.;
/** CHILD AGE GROUPS **/
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";
/** CHILD BREASTFED WITHIN ONE HOUR **/
IF M34 in(0:100) THEN WITHIN_HOUR="1. Yes";
IF M34 not in(0:100) THEN WITHIN_HOUR="0. No";
/** CHILD BREASTFED WITHIN ONE DAY **/
IF M34 in(0:200) THEN WITHIN_ONE_DAY="1. Yes";
IF M34 not in(0:200) THEN WITHIN_ONE_DAY="0. No";
/** FOR TABLE 11.2 - PERCENTAGE EVER BREASTFED **/
IF M4 in(93,95) THEN ever_breastfed="1. Yes";
IF M4 not in(93,95) THEN ever_breastfed="0. No";
/** 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";
/** PRELACTEAL FEED **/
IF M55Z =1 THEN prelacteal="1. No";
IF M55Z NOT IN(1) THEN prelacteal="1. Yes";
/** MATERNAL AGE AT BIRTH **/
agebirth = int((B3-V011)/12);
IF agebirth <20 THEN age_at_birth ="1. <20";
IF agebirth IN(20:34) THEN age_at_birth ="2. 20-34";
IF agebirth >=35 THEN age_at_birth ="3. 35-49";
/** BIRTH ORDER **/
birth_order1 = bord;
IF B0 IN(2) THEN birth_order1 = bord - 1;
IF B0 IN(3) THEN birth_order1 = bord - 2;
IF birth_order1 IN(1) THEN birth_order ="1";
IF birth_order1 IN(2:3) THEN birth_order ="2-3";
IF birth_order1 IN(4:5) THEN birth_order ="4-5";
IF birth_order1 >=6 THEN birth_order ="6+";
DROP agebirth birth_order1;
RUN;
/********************************************************************/
PROC FREQ DATA=WORK.EDHS_BF;
WEIGHT WEIGHT;
TITLE "EVER BREASTFED ANALYSIS";
TABLES B4 * ever_breastfed /NOCOL NOFREQ NOPERCENT;
TABLES age_at_birth * ever_breastfed /NOCOL NOFREQ NOPERCENT;
TABLES birth_order * ever_breastfed /NOCOL NOFREQ NOPERCENT;
TABLE place_delivery * ever_breastfed /NOCOL NOFREQ NOPERCENT;
TABLE v025 * ever_breastfed /NOCOL NOFREQ NOPERCENT;
TABLE V024 * ever_breastfed /NOCOL NOFREQ NOPERCENT;
TABLE V190 * ever_breastfed /NOCOL NOFREQ NOPERCENT;
RUN;
/********************************************************************/
/** WITHIN ONE HOUR ANALYSIS **/
PROC FREQ DATA=WORK.EDHS_BF;
WEIGHT WEIGHT;
TITLE "WITHIN ONE HOUR ANALYSIS";
TABLES B4 * WITHIN_HOUR /NOCOL NOFREQ NOPERCENT;
TABLES age_at_birth * WITHIN_HOUR /NOCOL NOFREQ NOPERCENT;
TABLES birth_order * WITHIN_HOUR /NOCOL NOFREQ NOPERCENT;
TABLE place_delivery * WITHIN_HOUR /NOCOL NOFREQ NOPERCENT;
TABLE v025 * WITHIN_HOUR /NOCOL NOFREQ NOPERCENT;
TABLE V024 * WITHIN_HOUR /NOCOL NOFREQ NOPERCENT;
TABLE V190 * WITHIN_HOUR /NOCOL NOFREQ NOPERCENT;
RUN;
/********************************************************************/
/** WITHIN ONE DAY ANALYSIS **/
PROC FREQ DATA=WORK.EDHS_BF;
WEIGHT WEIGHT;
TITLE "WITHIN ONE DAY ANALYSIS";
TABLES B4 * WITHIN_ONE_DAY /NOCOL NOFREQ NOPERCENT;
TABLES age_at_birth * WITHIN_ONE_DAY /NOCOL NOFREQ NOPERCENT;
TABLES birth_order * WITHIN_ONE_DAY /NOCOL NOFREQ NOPERCENT;
TABLE place_delivery * WITHIN_ONE_DAY /NOCOL NOFREQ NOPERCENT;
TABLE v025 * WITHIN_ONE_DAY /NOCOL NOFREQ NOPERCENT;
TABLE V024 * WITHIN_ONE_DAY /NOCOL NOFREQ NOPERCENT;
TABLE V190 * WITHIN_ONE_DAY /NOCOL NOFREQ NOPERCENT;
RUN;
/********************************************************************/
/** PRELACTEAL FEED ANALYSIS **/
PROC FREQ DATA=WORK.EDHS_BF;
WHERE ever_breastfed = "1. Yes";
WEIGHT WEIGHT;
TITLE "PRELACTEAL FEED ANALYSIS";
TABLES B4 * prelacteal /NOCOL NOFREQ NOPERCENT;
TABLES age_at_birth * prelacteal /NOCOL NOFREQ NOPERCENT;
TABLES birth_order * prelacteal /NOCOL NOFREQ NOPERCENT;
TABLE place_delivery * prelacteal /NOCOL NOFREQ NOPERCENT;
TABLE v025 * prelacteal /NOCOL NOFREQ NOPERCENT;
TABLE V024 * prelacteal /NOCOL NOFREQ NOPERCENT;
TABLE V190 * prelacteal /NOCOL NOFREQ NOPERCENT;
RUN;
/********************************************************************/
PROC SURVEYLOGISTIC DATA=WORK.EDHS_BF;
STRATA V023;
CLUSTER v021;
WEIGHT WEIGHT;
TITLE "REGRESSION: EVER BREASTFED";
CLASS B4(REF=FIRST) age_at_birth(REF=FIRST) birth_order(REF=FIRST) place_delivery(REF=FIRST) V190(REF=FIRST) V025(REF=LAST) V024(REF=LAST) /PARAM=REF;
MODEL ever_breastfed (EVENT = '1. Yes') = B4 age_at_birth birth_order place_delivery V190 V025 V024;
ODS OUTPUT OddsRatios=OR2 ;
RUN;
/********************************************************************/
PROC SURVEYLOGISTIC DATA=WORK.EDHS_BF;
STRATA V023;
CLUSTER v021;
WEIGHT WEIGHT;
TITLE "REGRESSION: PRELACTEAL FEED";
WHERE ever_breastfed = "1. Yes";
CLASS B4(REF=FIRST) age_at_birth(REF=FIRST) birth_order(REF=FIRST) place_delivery(REF=FIRST) V190(REF=FIRST) V025(REF=LAST) V024(REF=LAST) /PARAM=REF;
MODEL prelacteal (EVENT = '1. Yes') = B4 age_at_birth birth_order place_delivery V190 V025 V024;
ODS OUTPUT OddsRatios=OR2 ;
RUN;
|
|
|