BookmarkSubscribeRSS Feed
Natasha2018
Calcite | Level 5
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
6 REPLIES 6
Reeza
Super User

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.

 

 

PGStats
Opal | Level 21

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
PGStats
Opal | Level 21

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
Natasha2018
Calcite | Level 5
Thanks for your help
I tried doing this but it yielded confidence intervals for the numerator and not the proportion.

Reeza
Super User

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.


 

PGStats
Opal | Level 21

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

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 6 replies
  • 1623 views
  • 0 likes
  • 3 in conversation