BookmarkSubscribeRSS Feed
ChristinaWang
Calcite | Level 5

Hi,

I have a dataset that looks like the following,

variable x  :1 = very worried, 2 = slightly worried ,3 = Not worried

variable y : 1  = more likely, 2 = no change ,3 = less likely
I would like to comparsion the factor variable x and outcome variable y.

Which 's test inside sas will give the right p-value?

Thanks.

2 REPLIES 2
PGStats
Opal | Level 21

A good general purpose test for the relationship between two categorical variables is Fisher's exact test. If your number of observations is not too large ( < 100 say), use the following :

proc freq data=myData;

tables x*y;

exact Fisher / maxtime=20;

run;

If the computation doesn't terminate within 20 seconds, add the MC option to the EXACT statement.

PG

PG
Doc_Duke
Rhodochrosite | Level 12

Christina,

"Right" is a very slippery term in this sort of analysis.  There is probably no single answer.  There is a huge literature on testing association among ordered variables.

The Fisher's Exact Test that PG recommended is a general purpose test that could be used, but it is known to be conservative.  If your sample size is larger, then you could use the Chi-Squared test that is part of PROC FREQ to address general association.

Neither of these tests take advantage of the inherent ordering of the two variables.  I prefer Kendall's Tau-b (also part of FREQ).

Doc Muhlbaier

Duke

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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