* Program to change the weights of pooled surveys to match the population size * "target" is the estimated population of the country, in millions * Illustrate with pooling of India, Nepal, Bangladesh. using estmated 2020 population * India and Nepal and Bangladesh: 1,442 million and 29 million and 166 million * specify a workspace cd e:\DHS\DHS_data\scratch * PART 1. Run through the surveys to get the total weight and specify targets use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\IAPR7EFL.DTA", clear gen wt=hv005/1000000 collapse (sum) wt gen survey=1 gen target=1442 save survey_list.dta, replace use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\NPPR82FL.DTA", clear gen wt=hv005/1000000 collapse (sum) wt gen survey=2 gen target=29 append using survey_list.dta save survey_list.dta, replace use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\BDPR81FL.DTA" gen wt=hv005/1000000 collapse (sum) wt gen survey=3 gen target=166 append using survey_list.dta save survey_list.dta, replace * Similarly for other surveys to be pooled * PART 2. After the last survey, prepare the file of survey-specific factors use survey_list.dta, clear sort survey rename wt survey_totwt egen all_surveys_totwt=total(survey_totwt) gen sampleprop=survey_totwt/all_surveys_totwt egen all_surveys_target=total(target) gen targetprop=target/all_surveys_target gen factor=targetprop/sampleprop list, table clean keep survey factor save survey_list.dta, replace * PART 3. Run through the surveys again, appending them use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\IAPR7EFL.DTA", clear gen survey=1 quietly append using "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\NPPR82FL.DTA" replace survey=2 if survey==. quietly append using "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\BDPR81FL.DTA" replace survey=3 if survey==. * Similarly for other surveys to be pooled * PART 4. After the last survey, merge the survey-specific factors onto each survey and * calculate revised weights merge m:1 survey using survey_list.dta drop _merge gen hv005r=hv005*factor * hv005r, like hv005, should be an integer replace hv005r=round(hv005r) gen wt =hv005 /1000000 gen wtr=hv005r/1000000