mantelhaen.test(X, Y= NULL, Z = NULL, alternative = c("two.sided", "less", "greater"), correct = TRUE, exact = FALSE, conf.level = 0.95)
Where,
X- either a 3-dimensional contingency table in array form where each dimension is at least 2 and the last dimension corresponds to the strata, or a factor object with at least 2 levels
Y- a factor object with at least 2 levels; ignored if x is an array.
Z- a factor object with at least 2 levels identifying to which stratum the corresponding elements in x and y belong; ignored if x is an array.
Alternative - indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. Only used in the 2 by 2 by K case.
Correct- a logical indicating whether to apply continuity correction when computing the test statistic. Only used in the 2 by 2 by K case
.
Exact- a logical indicating whether the Mantel-Haenszel test or the exact conditional test (given the strata margins) should be computed. Only used in the 2 by 2 by K case.
Conf. level - confidence level for the returned confidence interval. Only used in the 2 by 2 by K case.
Ronán Michael Conroy , I suspect the the test you've indicated is the MH test for homogeneity of odds ratio, not the CMH test that the OP asked about. I'm not sure, though. It sounds like the Stata module of interest is emh. SAS adds to the confusion by using "Cochran-Mantel-Haenszel" for what SPSS and R call "linear-by-linear" association. We really need latin names for these things. I'm trying to sort this out here: https://stats.stackexchange.com/questions/423722/analysis-2x2x2-contingency-table