BookmarkSubscribeRSS Feed
SSN_Ravi
Calcite | Level 5

Hi,

 

I am trying to calculate binomial CI for my efficacy data using below code. But it is throwing error when we have only one category(resp='0') in response variable for a particular category of by variable. As i am using LEVEL=2 option its throwing error. Let me know how to handle this.

 

proc freq data=dsin1;
  by  viswin  leg_sort ;
  tables &G_A_RESPVAR/ binomial (level=2);
  exact binomial;
  ods output OneWayFreqs=freqs
             BinomialProp=Exttst(where=(name1 in("XL_BIN", "XU_BIN")));
run;

 

Thanks,

Ravi.

3 REPLIES 3
ballardw
Super User

It really helps to show the code and error from the log. Best is to post it in a code box using the {i} menu icon in the forum as the main message windows will reformat text and many error messages include indicators as to the issue that get moved.

 

In general all confidence intervals require some variability in the data or you get a 0 width interval. It may be that you want to exclude the specific case(s) with only one response level from the analysis

SSN_Ravi
Calcite | Level 5

Here is the error message

 

ERROR: The BINOMIAL LEVEL= value is greater than the number of levels for variable RESPSD1.

ballardw
Super User

Maybe if we create a similar example it will help:

data example;
   input x ;
datalines;
1 
1 
1 
1 
1 
;
proc freq data=example;
   tables x /binomial(level=2);
   exact binomial;
run;

Generates that error. It is an error. In your case it may well only occur for some combinations of your by variables. Find out which combination (or combinations). Then using a WHERE clause do not use the analysis for those combinations. Note that for those combinations you will output similar to that generated by:

 

proc freq data=example;
   tables x /binomial(level=1);
   exact binomial;
run;   

So run the code with the correct level only for those combinations.

 

 

Suppose you determine that  the combination  viswin=3  leg_sort=5 is the only combination with this problem then:

proc freq data=dsin1;
  by  viswin  leg_sort ;
  where viswin ne 3 and leg_sort ne 5;
  tables &G_A_RESPVAR/ binomial (level=2);
  exact binomial;
  ods output OneWayFreqs=freqs
             BinomialProp=Exttst(where=(name1 in("XL_BIN", "XU_BIN")));
run;

proc freq data=dsin1;
  by  viswin  leg_sort ;
  where viswin = 3 and leg_sort = 5;
  tables &G_A_RESPVAR/ binomial (level=1);
  exact binomial;
  ods output OneWayFreqs=freqs1Level
             BinomialProp=Exttst1Level(where=(name1 in("XL_BIN", "XU_BIN")));
run;

Of course if you have many combinations of the by variables with this issue then you may want to rethink things in general.

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 2644 views
  • 0 likes
  • 2 in conversation