BookmarkSubscribeRSS Feed
LucasL
Calcite | Level 5

Hello,

 

I am struggling with running tests on two dichotomous variables. I don't think I'm doing it correctly and I don't know how to interpret my output. My advisor said to do Chi-Square. When I do Chi square, I end up with info like this: 

 

chi square test for equal proportions

chi square: 703.7583

DF: 1

PR>ChiSq: <.0001

 

This is my code:

Proc Freq data=filea;

tables Variable1 Variable2

/chisq;

run;

 

Thank you for any help you can provide!

2 REPLIES 2
SAS_Rob
SAS Employee

The way you have it set up now, you will get two separate Chi-Square tests.  Each test will test whether the proportions for the two groups are the same.  Assuming that the output you posted was for Variable1, it is testing whether P(Variable1=Level 1)=P(Variable1=Level 2).

 

It might be that your intention is to test the equality of independent proportions, in which case you need to cross the two variables on the TABLES statement.

tables Variable1*Variable2/chisq;

Ksharp
Super User
What kind of test do you want to do ?
If it is two way contingency table ,you need symbol '*' .

Proc Freq data=filea;
tables Variable1*Variable2
/chisq fisher agree ;
run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1241 views
  • 2 likes
  • 3 in conversation