Y'all,
I am using Stata 13.1 on windows 7. I am trying to export my Stata output, including my confidence intervals to an excel file.
I use this code for the whole population, and it works:
estpost svy: tabulate diabetes , percent ci // diabetes prevalence
mat pct = e(b)'
mat lb = e(lb)'
mat up = e(ub)'
putexcel A3=("Non diabetes") A4=("diabetes") B3=matrix(pct) C2= ("Lower CI") c3=matrix(lb) D2=("Upper CI") d3=matrix(up) using test, replace
But when I try to specify my analysis to one age group by the following code I get this error: confidence interval cannot be estimated "stratum with single sampling unit."
estpost svy: tabulate diabetes if age==1 , percent ci // diabetes prevalence
mat pct = e(b)'
mat lb = e(lb)'
mat up = e(ub)'
putexcel A3=("Non diabetes") A4=("diabetes") B3=matrix(pct) C2= ("Lower CI") c3=matrix(lb) D2=("Upper CI") d3=matrix(up) using test, replace
I tried to use preserve keep age==1 and then restore commands, but it did not work.
Thank you guys in advance.
I am using Stata 13.1 on windows 7. I am trying to export my Stata output, including my confidence intervals to an excel file.
I use this code for the whole population, and it works:
estpost svy: tabulate diabetes , percent ci // diabetes prevalence
mat pct = e(b)'
mat lb = e(lb)'
mat up = e(ub)'
putexcel A3=("Non diabetes") A4=("diabetes") B3=matrix(pct) C2= ("Lower CI") c3=matrix(lb) D2=("Upper CI") d3=matrix(up) using test, replace
But when I try to specify my analysis to one age group by the following code I get this error: confidence interval cannot be estimated "stratum with single sampling unit."
estpost svy: tabulate diabetes if age==1 , percent ci // diabetes prevalence
mat pct = e(b)'
mat lb = e(lb)'
mat up = e(ub)'
putexcel A3=("Non diabetes") A4=("diabetes") B3=matrix(pct) C2= ("Lower CI") c3=matrix(lb) D2=("Upper CI") d3=matrix(up) using test, replace
I tried to use preserve keep age==1 and then restore commands, but it did not work.
Thank you guys in advance.
Comment