* do e:\DHS\programs\immunizations\basic_antigens_do_9Nov2023.txt * Table 10.3 in the Kenya 2022 Final Report (page 319) * Limited to the first 3 columns, on age 12-23 months, and most rows but not all * According to Keith Purvis (Nov. 3), h60 can substitute for one of the 3 polio * immunizations * Tom Pullum, November 2023. ********************************************************************************** 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 make_codes gen wt=v005/1000000 * The restriction to 12-23 months can be done without reducing the file.... keep if b19>=12 & b19<=23 * Restrict to cases with a card tab h1 [iweight=wt] keep if h1<=3 * Specify the source of the information (bottom row of table) gen source=2 if h1<=. replace source=1 if h1==1 label define source 1 "Vaccination card" 2 "Mother's report" label values source source tab source [iweight=wt] * c for card, m for mother, e for either * Construct binary indicators for each type of vaccination, by source 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="h54" scalar spneu2="h55" scalar spneu3="h56" scalar srota1="h57" scalar srota2="h58" scalar smr1="h9" scalar smr2="h9a" * Need to substitute within a series. For example, * if dpt1 is no, but dpt2 is yes, then dpt1 is replaced with dpt2 scalar sv1=sdpt1 scalar sv2=sdpt2 scalar sv3=sdpt3 substitutions3 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 scalar sv1=smr1 scalar sv2=smr2 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 ipv pneu1 pneu2 pneu3 rota1 rota2 mr1 mr2 quietly foreach lv of local lvacc { scalar sv=s`lv' local hv=sv * Report comes from either (crude rate) gen `lv'_e=0 replace `lv'_e=100 if `hv'==1 | `hv'==2 | `hv'==3 * Report comes from the mother gen `lv'_m=0 replace `lv'_m=100 if `hv'==2 & h1~=1 * Report comes from the card gen `lv'_c=0 replace `lv'_c=100 if `lv'_e==100 & `lv'_m==0 } * variables for groups of vaccinations are defined with the "_e" version: * 3 doses of dpt gen dpt=100 if dpt1_e==100 & dpt2_e==100 & dpt3_e==100 * 3 doses of pneu gen pneu=100 if pneu1_e==100 & pneu2_e==100 & pneu3_e==100 * two doses of rota gen rota=100 if rota1_e==100 & rota2_e==100 * one dose of mr gen mr=100 if mr1_e==100 | mr2_e==100 * The stated definition of fully basic in footnote 5 * The following line would implement a requirement of polio 1, 2, and 3 *gen polio=100 if polio1_e==100 & polio2_e==100 & polio3_e==100 * Footnote 5 should allow IPV to substitute for polio3: gen polio=100 if polio1_e==100 & polio2_e==100 & (polio3_e==100 | ipv_e==100) * Construct the definition of basic antigens (footnote 5 of table 10.3) * Do not distinguish the components by c, m, e. Use "source" after combining the "e"'s. gen fullybasic_c=0 gen fullybasic_m=0 gen fullybasic_e=0 replace fullybasic_e=100 if bcg_e==100 & dpt==100 & polio==100 & mr==100 replace fullybasic_c=100 if fullybasic_e==100 & source==1 replace fullybasic_m=100 if fullybasic_e==100 & 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, using tabstat keep wt source *_c *_m *_e /* * Numbers in the rows for polio and ipv tabstat polio*_c ipv_c [fweight=v005], statistics(mean) tabstat polio*_m ipv_m [fweight=v005], statistics(mean) tabstat polio*_e ipv_e [fweight=v005], statistics(mean) * Numbers in the rows for bcg, dpt, pneu, rota, and mr tabstat bcg*_c dpt*_c pneu*_c rota*_c mr*_c [fweight=v005], statistics(mean) tabstat bcg*_m dpt*_m pneu*_m rota*_m mr*_m [fweight=v005], statistics(mean) tabstat bcg*_e dpt*_e pneu*_e rota*_e mr*_e [fweight=v005], statistics(mean) tabstat fullybasic* [fweight=v005], statistics(mean) */ * Alternative format that is closer to the format of table 10.3 in the report collapse (mean) *_c *_m *_e [iweight=wt] 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 ipv* 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 mr2* imm*_16 rename fullybasic* imm*_17 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 "IPV" 10 "Pneumococcal 1" 11 "Pneumococcal 2" 12 "Pneumococcal 3" 13 "Rotavirus 1" 14 "Rotavirus 2" 15 "Measles 1" 16 "Measles 2" 17 "Fully (basic)" label values immunization imm format Card Mother Either %7.3f 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'\KEKR8BFL.DTA", clear make_codes make_table