BookmarkSubscribeRSS Feed
paulrutti
Calcite | Level 5

Have category variable and within each category, a binary (0,1) variable.  Need 95% CI for all categories.  But if ratio is 0%, there is nothing in the output file, so how do I find the upper limit 95% CI using PROC FREQ (or alternate procedure).

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @paulrutti and welcome to the SAS Support Communities!

 

The ZEROS option of the WEIGHT statement is often useful in this situation. Does the example below help you?

/* Create sample data for demonstration */

data have;
do category='A', 'B', 'C';
  do _iorc_=1 to 9;
    _n_+1;
    binvar=(_n_<17);
    output;
  end;
end;
run;

/* Create intermediate dataset including combinations with zero frequencies */

proc freq data=have noprint;
tables category*binvar / sparse out=cnt;
run;

/* Compute confidence intervals for the proportion of BINVAR=1 in each category */

proc freq data=cnt;
by category;
weight count / zeros;
tables binvar / binomial(level='1');
run;

 

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1267 views
  • 3 likes
  • 2 in conversation