0

I want to check p-value in chi-Square test, and this is my code in SAS.

data dataA;
  input Ball $ observed;
  datalines;
A 1
B 0
C 0
D 0
E 9
;
run;

proc freq data=dataA;
    tables Ball / chisq;
    weight observed;
run;

enter image description here

Here is a problem. This Chi-square test did not include when value is 0. Actually, DF is 4, but now it's 1.

The below calculation is what I want (Chi-square should be 31), including 0 values.

enter image description here

How can I include the category with 0 value so that DF becomes 4, not 1? and Chi-squared becomes 31, not 6.4?

Thanks!!

Jin.w.Kim
  • 599
  • 1
  • 4
  • 15

1 Answers1

2

You need to use ZEROS option on the WEIGHT statement.

proc freq data=dataA;
    tables Ball / chisq;
    weight observed / zeros;
run;
data _null_
  • 8,534
  • 12
  • 14