* do e:\DHS\programs\immunizations\Kenya2014_basic_antigens_do_17Jan2024.txt * Table 10.2 in the Kenya 2014 Final Report (page 142) * Tom Pullum, January 2024. /* This program matches the first 3 lines of table 10.2 except for Polio. I have not been able to interpret Footnote 2: "Polio 0 is the polio vaccination given at birth. The data on polio vaccination were adjusted for a likely misinterpretation of polio 0 and polio 1; for children whose mothers reported that they received three doses of DPT-HepB-Hib and polio 0, polio 1, and polio 2, it was assumed that polio 0 was in fact polio 1, polio 1 was polio 2 and polio 2 was polio 3." IPV not included in this survey Only one possible dose of measles vaccine Rota is included in the data but not in the table Rota is included in the results but not in basic or fully Children with . on both h1 and the individual h are . on this outcome, but children who are . on just h1 or just the individual h are not . If there is a card, it gets priority "Reported by the mother" for measles, for example, includes these cells in the cross tab of h9 x h1: (2,0) (2,3) (.,2) */ ********************************************************************************** program define substitutions2 * Situations in which the first immunization in a series of 2 has "no" and * must be replaced by the second in the series, local lv1=sv1 local lv2=sv2 gen type=0 replace type=1 if (`lv1'==0 | `lv1'==8) & (`lv2'>0 & `lv2'<8) replace `lv1'=`lv2' if type==1 replace `lv2'=0 if type==1 drop type end ********************************************************************************** program define substitutions3 * Situations in which an earlier immunization in a series of 3 has "no" and * must be replaced by the next in the series, local lv1=sv1 local lv2=sv2 local lv3=sv3 gen type=0 replace type=1 if (`lv1'==0 | `lv1'==8) & (`lv2'>0 & `lv2'<8) replace `lv1'=`lv2' if type==1 replace `lv2'=0 if type==1 replace type=0 replace type=1 if (`lv1'==0 | `lv1'==8) & (`lv3'>0 & `lv3'<8) replace `lv1'=`lv3' if type==1 replace `lv3'=0 if type==1 replace type=0 replace type=1 if (`lv2'==0 | `lv2'==8) & (`lv3'>0 & `lv3'<8) replace `lv2'=`lv3' if type==1 replace `lv3'=0 if type==1 drop type end ********************************************************************************** program define shift_polio * Recode to shift some polio cases * Note 2 for table 10.2: for children whose mothers reported that they * received three doses of DPT-HepB-Hib and polio 0, polio 1, and polio 2, * it was assumed that polio 0 was in fact polio 1, polio 1 was polio 2 * and polio 2 was polio 3 tab h0 h1 if source==2 [iweight=v005/1000000] tab h4 h1 if source==2 [iweight=v005/1000000] tab h6 h1 if source==2 [iweight=v005/1000000] tab h8 h1 if source==2 [iweight=v005/1000000] tab h8 h1 if source==2 [iweight=v005/1000000], nolabel gen shift=1 if source==2 & h3==2 & h5==2 & h7==2 & h0==2 & h4==2 & h6==2 & h8==0 tab shift,m replace h8=2 if shift==1 drop shift end ********************************************************************************** program define make_codes gen wt=v005/1000000 * b19 is not in the 2014 survey, construct a proxy gen b19=v008-b3 * The restriction to 12-23 months can be done without reducing the file.... keep if b19>=12 & b19<=23 gen source=1 if h1==1 replace source=2 if h1~=1 replace source=. if h1==. & h9==. label define source 1 "Card" 2 "Mother" label values source source * DO NOT restrict to cases with a card because some such cases have a * response from the mother * c for card, m for mother, e for either * Construct binary indicators for each type of vaccination, by source * Improve the names scalar sbcg="h2" scalar sdpt1="h3" scalar sdpt2="h5" scalar sdpt3="h7" scalar spolio0="h0" scalar spolio1="h4" scalar spolio2="h6" scalar spolio3="h8" *scalar sipv="h60" scalar spneu1="spn1" scalar spneu2="spn2" scalar spneu3="spn3" scalar srota1="srv1" scalar srota2="srv2" scalar smr1="h9" * Need to substitute within a series. For example, * if dpt1 is no, but dpt2 is yes, then dpt1 is replaced with dpt2 * Note 2 for table 10.2: for children whose mothers reported that they * received three doses of DPT-HepB-Hib and polio 0, polio 1, and polio 2, * it was assumed that polio 0 was in fact polio 1, polio 1 was polio 2 * and polio 2 was polio 3 scalar sv1=sdpt1 scalar sv2=sdpt2 scalar sv3=sdpt3 substitutions3 * Must shift polio as in note 2 before doing the substitution shift_polio scalar sv0=spolio0 scalar sv1=spolio1 scalar sv2=spolio2 scalar sv3=spolio3 substitutions3 scalar sv1=spneu1 scalar sv2=spneu2 scalar sv3=spneu3 substitutions3 scalar sv1=srota1 scalar sv2=srota2 substitutions2 * The following lines give the indicators for rows of the table, age 12-23 months local lvacc bcg dpt1 dpt2 dpt3 polio0 polio1 polio2 polio3 pneu1 pneu2 pneu3 rota1 rota2 mr1 * To match the n's we must keep all combinations of h1 (has health card) and * the other specific h's EXCEPT those that are NA on BOTH tab h9 h1 if source<. [iweight=v005/1000000],m tab h9 h1 if source<. [iweight=v005/1000000],m nolabel cell tab h9 h1 if source==1 [iweight=v005/1000000],m cell tab h9 h1 if source==2 [iweight=v005/1000000],m cell quietly foreach lv of local lvacc { scalar sv=s`lv' local hv=sv gen `lv'_e=0 if source<. gen `lv'_c=0 if source<. gen `lv'_m=0 if source<. replace `lv'_e=100 if source<. & (`hv'==1 | `hv'==2 | `hv'==3) replace `lv'_c=100 if source==1 & (`hv'==1 | `hv'==2 | `hv'==3) replace `lv'_m=100 if source==2 & (`hv'==1 | `hv'==2 | `hv'==3) } tabstat *_c [fweight=v005], statistics(mean) tabstat *_m [fweight=v005], statistics(mean) tabstat *_e [fweight=v005], statistics(mean) * variables for groups of vaccinations are defined with the "_e" version: * 3 doses of dpt gen dpt=0 if dpt1_e<. replace dpt=100 if dpt1_e==100 & dpt2_e==100 & dpt3_e==100 * 3 doses of polio other than polio0 gen polio=0 if polio1_e<. replace polio=100 if polio1_e==100 & polio2_e==100 & polio3_e==100 * 3 doses of pneu gen pneu=0 if pneu1_e<. replace pneu=100 if pneu1_e==100 & pneu2_e==100 & pneu3_e==100 * two doses of rota gen rota=0 if rota1_e<. replace rota=100 if rota1_e==100 & rota2_e==100 * one dose of mr gen mr=mr1_e /* * The following segment is not completely tested * Do not distinguish the components by c, m, e. Use "source" after combining the "e"'s. * "basic" is defined in footnote 3 gen basic_c=0 gen basic_m=0 gen basic_e=0 replace basic_e=100 if bcg_e==100 & dpt==100 & polio==100 & mr==100 replace basic_c=100 if basic_e==100 & source==1 replace basic_m=100 if basic_e==100 & source==2 * "fully" is defined in footnote 4 gen fully_c=0 gen fully_m=0 gen fully_e=0 replace fully_e=100 if basic_e==100 & pneu==100 replace fully_c=100 if fully_e==100 & source==1 replace fully_m=100 if fully_e==100 & source==2 gen none_c=0 gen none_m=0 gen none_e=0 replace none_e=100 if bcg_e==0 & dpt1_e==0 & polio1_e==0 & mr1_e==0 & pneu1_e==0 replace none_c=100 if none_e==100 & source==1 replace none_m=100 if none_e==100 & source==2 * cases needs different characters after the underscore to avert an * error in the collapse in "make_table" gen cases_cc=0 gen cases_mm=0 gen cases_ee=1 replace cases_cc=1 if source==1 replace cases_mm=1 if source==2 */ end ********************************************************************************** program define make_table * This routine is not needed if you just want to construct the indicators * Give the percentages as means of 0/100 variables keep wt source *_c* *_m* *_e* * Format similar to the format of table 10.2 in the report collapse (mean) *_c *_m *_e (sum) cases_cc cases_mm cases_ee [iweight=wt] * convert cc back to c, etc. rename *cc *c rename *mm *m rename *ee *e * Assign the variables to vectors to simplify a reshape command * tabstat would be an alternative to reshape rename bcg* imm*_1 rename dpt1* imm*_2 rename dpt2* imm*_3 rename dpt3* imm*_4 rename polio0* imm*_5 rename polio1* imm*_6 rename polio2* imm*_7 rename polio3* imm*_8 rename basic* imm*_9 rename pneu1* imm*_10 rename pneu2* imm*_11 rename pneu3* imm*_12 rename rota1* imm*_13 rename rota2* imm*_14 rename mr1* imm*_15 rename fully* imm*_16 rename none* imm*_17 rename cases* imm*_18 gen dummy=1 reshape long imm_c_ imm_m_ imm_e_, i(dummy) j(immunization) drop dummy rename imm_c Card rename imm_m Mother rename imm_e Either label define imm 1 "BCG" 2 "DPT1" 3 "DPT2" 4 "DPT3" 5 "Polio 0" 6 "Polio 1" 7 "Polio 2" 8 "Polio 3" 9 "Basic" 10 "Pneumococcal 1" 11 "Pneumococcal 2" 12 "Pneumococcal 3" 13 "Rotavirus 1" 14 "Rotavirus 2" 15 "Measles 1" 16 "Fully" 17 "None" 18 "Cases" label values immunization imm format Card Mother Either %7.1f list, table clean noobs end ********************************************************************************** ********************************************************************************** ********************************************************************************** ********************************************************************************** ********************************************************************************** * Execution begins here * Specify the path to the data as a scalar scalar spath="C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata" local lpath=spath use "`lpath'\KEKR72FL.DTA", clear make_codes make_table