Programming the statistical procedures from SAS

proc freq - chisq test resuls for zero counts...

New Contributor
Posts: 2

proc freq - chisq test resuls for zero counts...


hi all,

below is my data, I want generate chisq p-value for 5 tests together. I have data for 3 tests (1,2,3) but don’t have counts for test 4 and 5. these should include in the model to get pvalue. any one could suggest what I have to do? the below is the dummy data for your reference!


data test;
test=1; trt=1; count=6;output;
test=1; trt=2; count=6;output;
test=2; trt=1; count=10;output;
test=2; trt=2; count=6;output;
test=3; trt=1; count=8;output;
test=3; trt=2; count=6;output;
test=4; trt=1; count=0;output;
test=4; trt=2; count=0;output;
test=5; trt=1; count=0;output;
test=5; trt=2; count=0;output;

proc sort data=test;by test trt;run;
proc freq data=test order=data;
table test*trt/chisq;
weight count/zeros;

*when i run this code i am getting below warning not getting chisqure pvalue;

Statistics for Table of test by trt

Row or column sum zero. No statistics computed for this table.

Sample Size = 42

Posts: 3,835

Re: proc freq - chisq test resuls for zero counts...

In the chi-square test, you compute the quantities

(Observed - Expected) / Expected

for each cell, where Expected is the exoected value in the cell under the null hypothesis. For these data, the expected values for the cells in rows 4 and 5 are zero. Since 0/0 is mathematically undefined, it is not possible to compute the chi-square test. Consequently, what you are asking for doesn't make sense. 


What to do? You can

1. Collect more data until to observe counts in rows 4 and 5

2. Drop rows 4 and 5 from the analysis

3. Combine small categories into larger ones. For example, if the rows represent the categories "small", "medium", "large", "extra-large", and "huge", you can merge the last three categories into a new categoriy called "Big."


New Contributor
Posts: 2

Re: proc freq - chisq test resuls for zero counts...

Hi Rick,


Thanks for your responds Smiley Happy and help !



Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation