Skip to content
AgileLogics
7 min read

Logistic Regression with PROC LOGISTIC

Prerequisites: Analysis of variance with PROC GLM

Logistic regression models a yes/no outcome: the probability that an event happens. It's the workhorse of credit scoring, medical risk models, and marketing response models.

As a small example: does height predict whether a student in SASHELP.CLASS is a boy?

proc logistic data=sashelp.class;
   model sex(event='M') = height;
run;

Output (abridged):

             The LOGISTIC Procedure

               Response Profile

         Ordered                  Total
           Value    Sex       Frequency

               1    F                 9
               2    M                10

         Probability modeled is Sex='M'.

              Model Fit Statistics

                                Intercept and
Criterion     Intercept Only       Covariates

AIC                   28.287           28.086
SC                    29.231           29.975
-2 Log L              26.287           24.086

       Testing Global Null Hypothesis: BETA=0

Test                 Chi-Square     DF    Pr > ChiSq

Likelihood Ratio         2.2006      1        0.1380
Score                    2.0980      1        0.1475
Wald                     1.9008      1        0.1680

         Analysis of Maximum Likelihood Estimates

                             Standard          Wald
Parameter    DF   Estimate      Error    Chi-Square    Pr > ChiSq

Intercept     1    -9.0643     6.6690        1.8473        0.1741
Height        1     0.1472     0.1068        1.9008        0.1680

                 Odds Ratio Estimates

                   Point          95% Wald
Effect          Estimate      Confidence Limits

Height             1.159       0.940       1.428

How to read it:

  • event='M' — always say which value is the event. Otherwise SAS models the first ordered value (F here), and every sign flips.
  • Estimates are on the log-odds scale: each extra inch adds 0.147 to the log-odds of being a boy.
  • Odds ratio 1.159 — each inch multiplies the odds by about 1.16. But the confidence interval (0.940 to 1.428) includes 1, and Pr > ChiSq = 0.168: with 19 students, there's no clear evidence.
  • AIC and -2 Log L compare models: lower is better. The full output also includes concordance statistics such as the c statistic (the area under the ROC curve).

Predicted probabilities

proc logistic data=sashelp.class noprint;
   model sex(event='M') = height;
   output out=probs p=prob_m;
run;

prob_m is each student's predicted probability of being a boy. From the estimates, a 60-inch student gets about 0.44 and a 70-inch student about 0.78.

Real models

  • class region / param=ref; adds categorical predictors with reference coding.
  • / selection=stepwise, ctable, and outroc= support model building and cut-off choice.
  • score data=new out=scored; applies a fitted model to new data.
  • PROC HPLOGISTIC (and logistic actions in SAS Viya) fit the same models on very large data in parallel.