Pseudo SAS Code for Exact CI/(Un)stratified Analysis

Introduction

The following pseudo code assumes two arms, treatment vs control. When there are multiple groups, for each run of the code, only include one treatment vs the control comparison.

The relevant SAP texts are as follows:

ORR by treatment arm will be calculated along with the 2-sided 95% CI using the Clopper-Pearson method (exact CI for a binomial proportion as computed by default by the FREQ procedure using the EXACT option).

The association of treatment and OR will be tested by the General Association Statistic of the Cochran-Mantel-Haenszel test (CMH) with the randomization strata taken into account. The null hypothesis of no association in any of the randomization strata is tested against the alternative, which specifies that there is an association between treatment and tumor response at least in one randomization stratum. The CMH test will be performed at 1-sided alpha level of 0.025.

The stratified odds ratio in terms of OR will also be estimated along with its 95% CI to compare treatments. The odds ratio is defined as the odds of OR with test treatment divided by the odds of OR with control treatment. The Breslow-Day test will be used to check the homogeneity of the odds ratio across the randomization strata. It tests the null hypothesis that odds ratios in all strata are equal against the alternative hypothesis that at least in one stratum the odds ratio is different.

In case the null hypothesis of homogeneity of odds ratios across strata is not rejected at the 2-sided alpha level of 0.05, the common odds ratio will be determined using the Mantel-Haenszel estimate (by the FREQ procedure using CMH option in SAS); if the null hypothesis of homogeneity of odds ratio across all strata is rejected, the odds ratio per stratum will be calculated with the corresponding exact CI.

Exact CI for response rate

This is done without the stratification factors and arm by arm. In the level= option, specify the value corresponding to response. If not specified, SAS will take the value according to system default, which might give the non-response rate.

1
2
3
4
proc freq data=INDATA;
by TREATMENT;
tables RESPONSE / binomial(exact level=’value’) alpha=.05;
run;

The exact 95% CI for the response rate is requested by the binomial (exact) and alpha =0.05 options.

Confidence Limits for the Binomial Proportion
Proportion = 0.205195% Confidence Limits
TypeLowerUpper
Clopper-Pearson (Exact)0.14470.2771

Unstratified analysis

The code to use for unstratified analysis is:

1
2
3
4
proc freq data=INDATA;
tables TREATMENT*RESPONSE / cmh;
exact comor;
run;

Because there is no strata variable specified in the tables statement, the output is very simple, pick the odds ratio and its exact CL from the table as shown below.

Common Odds Ratio
Mantel-Haenszel Estimate1.5006
Asymptotic Conf Limits
95% Lower Conf Limit0.8540
95% Upper Conf Limit2.6368
Exact Conf Limits
95% Lower Conf Limit0.8216
95% Upper Conf Limit2.7512

Stratified analysis

The sequence of variables in the tables statement must be STRATA, then TREATMENT, then RESPONSE. If there are more than one variable for stratification, e.g. three, then the code will be STRATA1*STRATA2*STRATA3*TREATMENT*RESPONSE.

1
2
3
4
proc freq data=INDATA;
tables STRATA*TREATMENT*RESPONSE / cmh;
exact comor;
run;

P-values

The cmh option generates two statistics, the CMH statistics and the Breslow-Day statistics.

From CMH statistics, pick the p value associated with General Association. This is a 2-sided p value, compare this value to 0.05.

Cochran-Mantel-Haenszel Statistics (Based on Table Scores)
StatisticAlternative HypothesisDFValueProb
1Nonzero Correlation11.95130.1624
2Row Mean Scores Differ11.95130.1624
3General Association11.95130.1624

4.2 Common odds ratio in presence of homogeneity across strata

From Breslow-Day statistics, if the p-value (this is a 2-sided p value) > 0.05, then a common odds ratio will be reported. The exact confidence limit of this odds ratio is requested by the exact comor option.

Common Odds Ratio
Mantel-Haenszel Estimate1.5016
Asymptotic Conf Limits
95% Lower Conf Limit0.8500
95% Upper Conf Limit2.6526
Exact Conf Limits
95% Lower Conf Limit0.8167
95% Upper Conf Limit2.7497

4.3 Odds ratio within each strata in absence of homogeneity across strata

If the p value from Breslow-Day test <= 0.05, then run the following code to get the odds ratio and its exact confidence limits by stratum.

1
2
3
4
5
proc freq data=INDATA;
by STATA;
tables TREATMENT*RESPONSE / cmh;
exact comor;
run;

Strata variable = Level 1

Common Odds Ratio
Mantel-Haenszel Estimate1.6962
Asymptotic Conf Limits
95% Lower Conf Limit0.9071
95% Upper Conf Limit3.1718
Exact Conf Limits
95% Lower Conf Limit0.8684
95% Upper Conf Limit3.3560

Strata variable = Level 2

Common Odds Ratio
Mantel-Haenszel Estimate0.7857
Asymptotic Conf Limits
95% Lower Conf Limit0.1808
95% Upper Conf Limit3.4152
Exact Conf Limits
95% Lower Conf Limit0.1173
95% Upper Conf Limit4.0049