Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
eltrigo
Calcite | Level 5

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

 

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;

 

y.JPG

 

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

 

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

 

x.JPG

 

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!!

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

You should use the ZEROS option on the WEIGHT statement to include those cells with a zero count.

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

View solution in original post

1 REPLY 1
SAS_Rob
SAS Employee

You should use the ZEROS option on the WEIGHT statement to include those cells with a zero count.

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

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 1 reply
  • 915 views
  • 2 likes
  • 2 in conversation