A single test of whether any of several group proportions (pi, i=1,2,...,G) differs from the overall proportion is given by the CHISQ option in PROC FREQ (or PROC FREQTAB in SAS® Viya®) when applied to a G×2 or 2×G table of your data (the two columns or rows being positive and negative response). Significant results indicate that at least one proportion differs from the overall proportion. Tests and a graph of each group comparison to overall can be done in PROC LOGISTIC using the DIFF=ANOM option in the LSMEANS statement. You can also adjust the individual p-values for effects caused by multiple testing. In addition to the adjustments available using the ADJUST= option in the LSMEANS statement in LOGISTIC, the p-values can also be adjusted by importing them into PROC MULTTEST and using the methods available in that procedure.
Suppose that the sample sizes (N) and the number with positive response (Npos) in each of five groups are recorded in SAS data set Props. The observed proportion Proportion = Npos/N.
The following statements transform the aggregated (summarized) form of the data above into the form suitable to produce a 2×2 table for analysis in PROC FREQ or PROC FREQTAB. The CHISQ option produces a test of whether the groups all have equal positive response (Response=1) probabilities.
data Props2; set Props; Response=1; Count=Npos; output; Response=0; Count=N-Npos; output; run; proc freq data=Props2; weight Count; table Group*Response / chisq; run;
The marginally significant Pearson chi-square test from PROC FREQ indicates that some proportions might differ from the overall proportion (p=0.0537). The Likelihood Ratio chi-square (equivalent in large samples) provides a similar result. The Mantel-Haenszel chi-square is used when both row and column variables are ordinal and you want to test for a linear association in the variables. Since the groups are not ordered, the Group variable is nominal rather than ordinal making the Mantel-Haenszel chi-square test inappropriate.
The following statements fit a one-way logistic model. The LSMEANS statement estimates the group log odds and proportions. Note that GLM parameterization (PARAM=GLM) of the GROUP levels is required in order to use the LSMEANS statement. The ILINK option provides the group probability estimates (labeled "Mean"). The DIFF=ANOM option compares the five group proportions to the overall proportion. The ADJUST=BON and STEPDOWN options adjust the p-values using the Holm's stepdown adjustment method which is less conservative than the Bonferroni method. The ODS OUTPUT statement saves the comparisons table in a data set for later use as described below. Note that if there are covariates in addition to your Group variable, they can be added to the model. The LSMEANS statement will then provide group comparisons adjusted for the effects of the covariates. The LSMESTIMATE statement computes the average log odds over the five groups.
proc logistic data=Props; class Group / param=glm; model Npos/N = Group; lsmeans Group / ilink diff=anom adjust=bon stepdown; lsmestimate group 'Overall Log Odds' .2 .2 .2 .2 .2; ods output Diffs=GrpDiffs; run;
Note that the likelihood ratio chi-square test from PROC FREQ matches the one in the "Testing Global Null Hypothesis: BETA=0" table from PROC LOGISTIC. The "Group Least Squares Means" table provides the group log odds (Estimate column) and proportions (Mean column) matching those shown above. The results in the "Differences of Group Least Squares Means" table indicate that only the last group differs from overall (raw p=0.0046, Holm-adjusted p=0.0230). The DIFF=ANOM option in the LSMEANS statement provides a plot comparing each group's log odds with the average log odds (-1.3479), which matches the value computed by the LSMESTIMATE statement. If a group's bar extends beyond the Bonferroni-adjusted upper or lower decision limit (UDL or LDL), then that group's log odds and proportion differ significantly from overall. By default, the significance level for the decision limits is 0.05. The plot visually confirms the conclusion from PROC LOGISTIC that only the last group differs from overall. The
If desired, any of the p-value adjustment methods available in PROC MULTTEST (except the resampling-based bootstrap or permutation methods) can be used to adjust the difference p-values. The ODS OUTPUT statement above saved the p-values to a data set named GrpDiffs. In that data set, the variable containing the raw p-values is named Probz. Use the INPVALUES(variable-name)=data-set-name option in PROC MULTTEST to read the set of p-values. Specify the appropriate option(s) for your choice of nonresampling-based adjustment method(s). Below, the BON option provides the Bonferroni adjustment and the HOLM option provides the less conservative stepdown Bonferroni (Holm) adjustment.
proc multtest inpvalues(Probz)=GrpDiffs bon holm; run;
The results show that the adjusted p-values from the Holm stepdown method are very similar to the ordinary Bonferroni method in this case. The slightly less conservative nature of the Holm method is seen in Group 1.