You can try PROC FREQ and use the N as your weights, you may need to reformat your data a bit to get exactly what you need.
I think the first example is pretty close to your data structure.
You could also do the manual calculations in a data step assuming a binomial distribution.
This way:
data have;
input Agecat $ Numerator Denominator;
datalines;
10-19. 10 13325356
20-29. 13 1446666
30+ 60 1231555
;
proc genmod data=have;
class agecat;
model numerator/denominator = agecat / dist=binomial;
lsmeans agecat / ilink cl;
run;
Or you might just as well do:
data have;
input Agecat $ Numerator Denominator;
datalines;
10-19. 10 13325356
20-29. 13 1446666
30+ 60 1231555
;
data limits;
set have;
BinomialLowerN = quantile("binomial", 0.025, numerator/denominator, denominator);
BinomialUpperN = quantile("binomial", 0.975, numerator/denominator, denominator);
run;
Note: with such large denominators, using the Poisson distribution would yield the same intervals.
Your ratios are close to 0 so that the confidence intervals are pretty much 0 to 0.
See this example:
data have;
input Agecat $ Type N ;
datalines;
10-19. 1 10
10-19. 2 13325346
20-29. 1 13
20-29. 2 1446653
30+ 1 60
30+ 2 1231495
;
proc sort data=have;
by agecat;
run;
proc freq data=have;
by agecat;
table type / binomial ;
weight N;
run;
@Natasha2018 wrote:
Thanks for your help
I tried doing this but it yielded confidence intervals for the numerator and not the proportion.
proc genmod gave you the limits for the proportion in the Least Squares Means table under the Lower Mean and Upper Mean headings.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.