Cochran-Mantel-Haenszel Odds Ratios

Posts: 44

Cochran-Mantel-Haenszel Odds Ratios


I'm trying to generate summary odds ratios using the Cochran-Mantel-Haenszel test. All of the help documents say to specify a 'tables' statement and a statement to 'weight' by variable = Count. However, I have an analytical dataset and would like to summarize across one variable (VarA); I do not have a count variable. I've tried the code without the weight statement but haven't been successful. Does anyone have any suggestions? Thank you.    

Super User
Posts: 23,662

Re: Cochran-Mantel-Haenszel Odds Ratios

What do you have and what type of results are you looking for?

Posts: 44

Re: Cochran-Mantel-Haenszel Odds Ratios

My data set structure is similar to this:

data have;

  input ID $ Gender $ Treatment $ Response;


I would like to find the Mantel-Haenszel odds ratio for the association between treatment and response, summarized across gender. Instead of a count variable, I have one line per observation (ID number). According to this page, the result should be under the output table "Estimates of the Common Relative Risk". I'm interested in the result for the case-control study design. Thanks.  

Super User
Posts: 23,662

Re: Cochran-Mantel-Haenszel Odds Ratios

Can you show your full code. The example data gives results, but I'm not sure about the validity as they're all 1.

data Migraine;

   input Gender $ Treatment $ Response $ Count @@;


female Active  Better 16   female Active  Same 11

female Placebo Better  5   female Placebo Same 20

male   Active  Better 12   male   Active  Same 16

male   Placebo Better  7   male   Placebo Same 19


data migraine_expand;

set migraine;

do i=1 to count;




proc sort data=migraine_expand; by gender;

ods graphics on;

proc freq data=Migraine;

   tables gender*Treatment*Response /

          relrisk plots(only)=relriskplot(stats) cmh noprint;

   title 'Clinical Trial for Treatment of Migraine Headaches';


ods graphics off;

Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation