Programming the statistical procedures from SAS

SAS Aggregate data help

Reply
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

Posted in reply to Natasha2018

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.

 

 

Esteemed Advisor
Posts: 5,529

Re: SAS Aggregate data help

Posted in reply to Natasha2018

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;

PG
Esteemed Advisor
Posts: 5,529

Re: SAS Aggregate data help

Posted in reply to Natasha2018

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

Thanks for your 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

Posted in reply to Natasha2018

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.


 

Esteemed Advisor
Posts: 5,529

Re: SAS Aggregate data help

Posted in reply to Natasha2018

proc genmod gave you the limits for the proportion in the Least Squares Means table under the Lower Mean and Upper Mean headings.

PG
Ask a Question
Discussion stats
  • 6 replies
  • 147 views
  • 0 likes
  • 3 in conversation