New Contributor
Posts: 2

# SAS Aggregate data help

If I have only aggregate data available for the 3 different age categories how do I calculate the 95% confidence interval for each of the age categories in SAS. Thanks for all help in advance
Eg:
Age cat. Numerator Denominator Proportion
10-19. 10 13325356. 0.00000075
20-29. 13 1446666. 0.00000968
30+ 60. 1231555. 0.00004872
Super User
Posts: 23,724

## Re: SAS Aggregate data help

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.

Posts: 5,529

## Re: SAS Aggregate data help

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;
run;

``````
PG
Posts: 5,529

## Re: SAS Aggregate data help

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.

PG
New Contributor
Posts: 2

## Re: SAS Aggregate data help

I tried doing this but it yielded confidence intervals for the numerator and not the proportion.

Super User
Posts: 23,724

## Re: SAS Aggregate data help

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:
I tried doing this but it yielded confidence intervals for the numerator and not the proportion.

Posts: 5,529