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

Hello SAS community,

 

Currently I'm leaning towards some variations of Chi-Squares test. Particularly MH-Chisq but I would like to confirm before proceeding. 

 

My data structure is as the following:

 

data have;
    input StudyID location$ X1 X2;
    datalines;
    1 N 0 0
    1 E 0 1
    1 S 1 1
    2 N 1 1
    2 W 1 1
    2 E 1 0
    2 S 1 1
    ;
run;
  • StudyID - the subject ID ranges from 0-200
  • location - Categorical variable with possible values N,W,S,E. Each subject has measurements at taken at different locations, with a maximum of 4 different locations and minimum of 1 location. 
  • X1 and X2 - binary variables Yes/No type. I would like to test and see if there is any associations between X1 and X2. 

I believe the ordinary Chi-Square test runs under the assumption that observations are independent. But in my case I believe the observations are correlated within subjects. Is there a variation of the chi-square test where it takes the correlated data into consideration? 

 

Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

If each subject has only one pair of measurements at each location, then you could use the CMH option in PROC FREQ to test the association in the table stratified by location. For example:

 

proc freq;
  table location*x1*x2 / cmh;
  run;

View solution in original post

1 REPLY 1
StatDave
SAS Super FREQ

If each subject has only one pair of measurements at each location, then you could use the CMH option in PROC FREQ to test the association in the table stratified by location. For example:

 

proc freq;
  table location*x1*x2 / cmh;
  run;

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 582 views
  • 0 likes
  • 2 in conversation