BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MaryA_Marion
Lapis Lazuli | Level 10

I am doing a cochran-mantel-haenszel test using proc freq. The output is very confusing. Is there an order to the options included with the tables statement ?  For example, the Breslow-Day statistic is not always output and there are two cmh tables with different values. What are those supposed to be? I expected one cmh table with cmh1 cmh2 and cmh3.

 

SAS CODE:

data b;
input confounder $ treatment $ response $ count;
cards;
1 drug1 yes 19
1 drug1 no 3
1 drug2 yes 14
1 drug2 no 11
2 drug1 yes 27
2 drug1 no 18
2 drug2 yes 21
2 drug2 no 15
;

proc freq data=b order=data;
table treatment*response / nopercent norow nocol chisq relrisk;
weight count;
run cancel;

proc freq data=b order=data;
tables treatment*response / nopercent norow nocol relrisk chisq cmh(mf);
by confounder;
weight count;
run;
Thanks.

 

MM

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

CMH test is usually for three dimension contingency table .

I think you should involve one more variable in your model.

 

proc freq data=b order=data;
tables confounder*treatment*response / nopercent norow nocol  relrisk chisq cmh bdt;
weight count;
run;

View solution in original post

3 REPLIES 3
Ksharp
Super User

CMH test is usually for three dimension contingency table .

I think you should involve one more variable in your model.

 

proc freq data=b order=data;
tables confounder*treatment*response / nopercent norow nocol  relrisk chisq cmh bdt;
weight count;
run;
MaryA_Marion
Lapis Lazuli | Level 10
I know how to do it right but I had to keep removing table options ending up with only chisq and cmh(mf). This has happened to me multiple times with different datasets. These options generate code which sometimes conflict with each other. I think that's what is happening here. The order is important but I don't know the order. Thank you for the reply.
MaryA_Marion
Lapis Lazuli | Level 10
Thanks. I had put a "by confounder" statement in one of my tries. I won't make that mistake again. Your approach gives good output. I am verifyng doing it by hand. I like using cmh(mf). MM

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 1905 views
  • 2 likes
  • 2 in conversation