BookmarkSubscribeRSS Feed
EddieJackson
Calcite | Level 5

Quick question about the chi square from the surveyfreq command,

 

I'll enter something like the following:

 

PROC SURVEYFREQ DATA= code;
CLUSTER xxxx;
STRATA xxx;
weight xx;
TABLE obesity*gender/chisq;
RUN;

 

I get a chi square result. However if I double check this result with any online 2x2 table calculator, the p-value is different.

 

However if I do a regular PROC FREQ chisquare instead of surveyfreq, the p-value checks out with all those online calculators.

 

Am I doing something wrong with the surveyfreq command? Or is the calculation intrinsically different for a surveyfreq such that it won't check out with the online calculators like regular proc freq does?

 

Thanks

3 REPLIES 3
Watts
SAS Employee

Yes, it's a different statistic. The CHISQ option in PROC SURVEYFREQ provides a Rao-Scott chi-square test, which is a design-adjusted version of the Pearson chi-square test. The Rao-Scott chi-square test takes into account the complex survey design that you specify (in design options and statements -- e.g., STRATA and CLUSTER statements).

 

The CHISQ option in PROC FREQ provides the (unadjusted) Pearson chi-square.

 

For more info, the PROC SURVEYFREQ documentation is here .

 

 

Reeza
Super User
The marjority of online calculators do not take into account the weight and strata components. So the question is really, do you need those components and are you using them correctly.
EddieJackson
Calcite | Level 5

Thanks!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 661 views
  • 0 likes
  • 3 in conversation