IRS in last 12 months [message #12116] |
Wed, 29 March 2017 10:08 |
Nelly_WHO
Messages: 6 Registered: March 2017
|
Member |
|
|
Hello,
I am trying to reproduce the same figures as those published in the Statcompiler on the % of households with IRS in last 12 months. For some reasons, my figures do not align with yours.
Would it be possible to share the stata/sas code that have been used to calculate those figures so I can compare?
With the following code, the % for Kenya, 2014 is 2.5%. In Stata compiler it is 0.8%. what am I doing wrong? Is anyone can help?
Thank you very much,
Nelly
// Determine whether the survey has the variables of interest: IRS
cap confirm variable hv253
if _rc == 0 {
summ hv253
if `r(N)' != 0 {
rename hv253 irs_in_last_12mo
replace irs_in_last_12mo = . if irs_in_last_12mo > 1
gen sample_weight = hv005 / 1000000
rename hv001 cluster_num
keep iso3 startyear endyear module survey cluster_num hv023 sample_weight irs_in_last_12mo
// loop through to calculate survey-weighted means & SEs
svyset [pweight=sample_weight], psu(cluster_num) strata(hv023)
local m irs_in_last_12mo
svy: mean `m'
ereturn list
matrix mean_IRS = e(b)
matrix variance_IRS = e(V)
matrix N_IRS = e(N_psu)
local mean = mean_IRS[1,1]
local se = sqrt(variance_IRS[1,1])
local N = N_IRS[1,1]
gen mean_`m' = `mean'
gen semean_`m' = `se'
gen uci_`m' = mean_`m' + 1.96*semean_`m'
gen lci_`m' = mean_`m' - 1.96*semean_`m'
gen N = `N'
drop semean*
keep iso3 startyear endyear module survey mean_* uci* lci* N
keep in 1
save " ${outdir}/${iso3}_${startyear}_${endyear}_${survey}_${module }_IRS.dta ", replace
|
|
|