Calculate Population Counts from Stata Output Dataset

Statements Explanation
use "c:\stata\tutorial\age adjustment\popmeans", clear Use the use command to load the Stata-format dataset containing the prevalence estimates. Use the clear option to replace any data in memory.
merge riagendr race using  "c:\Stata\tutorial\age adjustment\poptot9902.dta" Use the merge command to combine the Stata dataset containing the population totals with the Stata dataset for the prevalence estimates using riagendr and race as the merging variables.
gen est=round(estimate,.01)

gen se=round(stderr,.01)

gen ll=round(min95,.01)

gen ul=round(max95,.01)

Use these statements to round and format the estimates.

 

gen popmean=(est/100)*ctutpopt

gen popl=(ll/100)*ctutpopt

gen popu=(ul/100)*ctutpopt

Use these statements to calculate the population counts by applying the population totals (ctutpopt) to the prevalence estimate (est) and the 95% confidence interval limits.
gen popmeanr=round(popmean,1000)

gen poplr=round(popl,1000)

gen popur=round(popu,1000)

gen poptot_r =round(ctutpopt,1000)

Use these statements to round and format the estimates to the nearest thousand.

save "c:\stata\tutorial\age adjustment\popmeans", replace Use the save command to save the dataset.
list riagendr race est se ll ul poptot_r popmeanr poplr popur, clean  Use the list command to display the variables and estimates. Use the clean option to force a table format with no divider or separator lines.

close window icon Close Window