The model on that example has considerable problems with separation issues and huge standard errors. Instead, consider the neuralgia data in the example titled "Logistic Modeling with Categorical Predictors" in the LOGISTIC documentation.
The following fits the interaction model between SEX and the spline on the continuous DURATION variable. The DETAILS option in the EFFECT statement shows that the knots are at 8 and 26, so the following DATA step adds observations at those values for both SEX levels in order to compute predicted values which are displayed by PROC PRINT after the model is fit in PROC LOGISTIC. All that is needed in the MODEL statement is the interaction term since the degrees of freedom for the two main effects get included with the interaction effect. So, the model fit is identical to specifying the main effects and interaction. The ESTIMATE statements use the nonpositional syntax to request the predicted values (on the log odds and, with the ILINK option, on the probability scale) for both sexes at both knot points. These are then confirmed by the predicted values at those points by the OUTPUT statement and displayed by PROC PRINT using the added observations.
data a;
duration=8; sex='M'; output;
duration=8; sex='F'; output;
duration=26; sex='M'; output;
duration=26; sex='F'; output;
run;
data b; set a neuralgia; run;
proc logistic data=b;
effect spld=spline(duration/ degree=1 details knotmethod=percentilelist(25,75));
class sex/param=glm;
model pain=spld*sex;
estimate
'F8' intercept 1 spld*sex[1, 1 8],
'F26' intercept 1 spld*sex[1, 1 26] / ilink e;
estimate
'M8' intercept 1 spld*sex[1, 2 8],
'M26' intercept 1 spld*sex[1, 2 26] / ilink e;
ods output coef=c;
store log;
output out=out p=p xbeta=xb;
run;
proc print data=out(obs=4);
run;
The slopes between the knots for each sex can then be computed, on the log odds scale, as the differences of the values at the knots using the following ESTIMATE statements. This is computed with the usual rise/run concept of a slope, so the difference is divided by 26-8=18. Plots of the fitted model on both the log odds (LINK option) and on the probability scale (no option) are given by the EFFECTPLOT statements.
proc plm source=log;
effectplot;
effectplot/link yrange=(-2,2);
estimate 'F logit slope' spld*sex [1, 1 8][-1, 1 26],
'M logit slope' spld*sex [1, 2 8][-1, 2 26] / divisor=18 cl;
run;
Finally, the slopes on the probability scale cannot be obtained using ESTIMATE statements, but can be obtained with the NLMeans macro using the fitted model from the STORE statement and the coefficients of the ESTIMATE statements as saved by the ODS OUTPUT statement in PROC LOGISTIC. Note that the use of the f=, fset=, and flabel= option requires the most recent release of the macro. See the macro documentation for details and more examples on using the macro and these options.
%nlmeans(instore=log, coef=c, link=logit, f=(mu1-mu2)/18, fset=1, flabel=F Prob Slope)
%nlmeans(instore=log, coef=c, link=logit, f=(mu1-mu2)/18, fset=2, flabel=M Prob Slope)
Note that this use of a rise/run computation assumes a straight line fit between the knots which generally is not true using splines and particularly when considering the model on the probability scale. But the plots seem to show reasonably straight lines in this example. Also note that the same approach could be used for a computation between other points
... View more