Hi everyone,
I need some help on Cochran-Mantel-Haenszel test (SAS Studio) in calculating the
1) the row mean score differ and
2) the general association for a set of data. (shown below)
Score below average average above average
Class X 1 9 20
Class Y 3 22 5
Class G 2 3 25
New to SAS, so every answer would be appreciated.
Thanks,
Hi @Sam20 and welcome to the SAS Support Communities!
The first step is to create a SAS dataset from the raw data (if not already done). The statistical tests will be done with PROC FREQ (see Example 46.7 Cochran-Mantel-Haenszel Statistics in the documentation). If the structure of the initial SAS dataset is not suitable for this procedure, you need to adapt it in an intermediate step.
Example:
/* Read raw data into SAS */
data have;
input class $7. below_av average above_av;
cards;
Class X 1 9 20
Class Y 3 22 5
Class G 2 3 25
;
/* Create input dataset for PROC FREQ */
proc transpose data=have name=score out=want(rename=(col1=n));
by class notsorted;
run;
/* Compute Cochran-Mantel-Haenszel statistics */
proc freq data=want;
label score=' ';
weight n;
tables class*score / cmh;
run;
Hi @Sam20 and welcome to the SAS Support Communities!
The first step is to create a SAS dataset from the raw data (if not already done). The statistical tests will be done with PROC FREQ (see Example 46.7 Cochran-Mantel-Haenszel Statistics in the documentation). If the structure of the initial SAS dataset is not suitable for this procedure, you need to adapt it in an intermediate step.
Example:
/* Read raw data into SAS */
data have;
input class $7. below_av average above_av;
cards;
Class X 1 9 20
Class Y 3 22 5
Class G 2 3 25
;
/* Create input dataset for PROC FREQ */
proc transpose data=have name=score out=want(rename=(col1=n));
by class notsorted;
run;
/* Compute Cochran-Mantel-Haenszel statistics */
proc freq data=want;
label score=' ';
weight n;
tables class*score / cmh;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.