Introduction
Logistic regression is one of the most commonly used regression techniques when the outcome is categorical. In clinical research, it is frequently used when the endpoint is binary—for example, response versus no response, event versus no event, or treatment success versus treatment failure.
In SAS, the principal procedure for these analyses is PROC LOGISTIC. The procedure can fit several related models, including binary logistic regression, cumulative ordinal logistic regression, adjacent-category or continuation-ratio models in appropriate settings, and generalized logit models for nominal outcomes.
The most important practical skill is not memorizing every option. It is understanding the relationship between the response variable, the predictors, the event being modeled, and the way SAS parameterizes categorical variables.
1. The Basic Logistic Regression Model
Suppose the outcome Y is binary, with Y = 1 representing an event of interest and Y = 0 representing no event. Let p = P(Y = 1).
The quantity on the left is the logit, or log odds, of the event. Unlike ordinary linear regression, the predicted probability is constrained to the interval from 0 to 1.
For a one-unit increase in X_j, holding the other predictors constant, the odds ratio is:
| Coefficient | Interpretation |
|---|---|
| \beta_j>0 | Higher values of the predictor are associated with higher odds of the modeled event. |
| \beta_j<0 | Higher values of the predictor are associated with lower odds of the modeled event. |
| \beta_j=0 | No association on the log-odds scale. |
| e^{\beta_j}>1 | Odds ratio greater than 1. |
| e^{\beta_j}<1 | Odds ratio less than 1. |
2. A First PROC LOGISTIC Example
Start with a simple binary endpoint. The following example assumes a dataset called analysis containing a binary variable response and a continuous predictor age.
proc logistic data=analysis;
model response = age;
run;
This single statement asks SAS to model response as a function of age. If the response is coded 0/1, SAS can use the binary logistic model directly.
3. A Complete Worked Clinical Example
Consider a simulated oncology study in which the endpoint is objective response at a defined assessment. We will model response as a function of treatment, baseline tumor burden, and age.
data oncology;
input usubjid $ treatment $ response age baseline_burden;
datalines;
P001 DrugA 1 58 82
P002 DrugA 0 67 115
P003 DrugA 1 49 76
P004 DrugA 1 62 91
P005 DrugA 0 71 134
P006 Placebo 0 55 109
P007 Placebo 1 63 88
P008 Placebo 0 69 121
P009 Placebo 0 52 97
P010 Placebo 1 60 83
;
run;
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
run;
This example introduces two ideas that are central to production SAS work: the CLASS statement and explicit event coding.
4. Understanding the CLASS Statement
Continuous variables are entered directly into the model. Categorical predictors require SAS to create the appropriate design variables. PROC LOGISTIC handles this through the CLASS statement.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
run;
Here, treatment is categorical, Placebo is the reference category, and param=ref requests reference-cell coding.
| CLASS specification | Meaning |
|---|---|
class treatment; | Tells SAS that treatment is categorical. |
ref='Placebo' | Uses Placebo as the comparison/reference category. |
param=ref | Uses reference parameterization. |
order=internal | Controls category ordering using internal formatted values. |
order=data | Orders categories according to their first appearance in the data. |
5. What Does an Odds Ratio Mean?
Suppose the fitted coefficient for Drug A versus Placebo is 0.80. The corresponding odds ratio is:
An odds ratio of 2.23 means that, conditional on the other variables in the model, the estimated odds of the modeled event are approximately 2.23 times as high for Drug A as for Placebo.
This is an odds interpretation, not a probability interpretation. An OR of 2 does not mean that the probability is twice as large.
Odds
If p=0.25, odds are 0.25/0.75=0.333.
Probability
The probability is 25%, while the corresponding odds are 1 to 3.
6. Odds Ratios Below 1
If a coefficient is negative, its exponentiation produces an odds ratio below 1. For example:
An OR of 0.60 indicates that the modeled-event odds are estimated to be 40% lower for a one-unit increase in the predictor, holding other variables constant.
For treatment comparisons, it is often useful to report both the OR and its reciprocal when the direction of comparison could otherwise be confusing. If Drug A versus Placebo has OR = 0.50, then Placebo versus Drug A has OR = 2.00.
7. The MODEL Statement
The basic syntax is:
proc logistic data=dataset;
model outcome = predictor1 predictor2 predictor3;
run;
The response appears to the left of the equals sign, and the explanatory variables appear on the right.
For a binary response, SAS estimates the intercept and slope parameters by maximum likelihood. The resulting output commonly includes the Model Information, Response Profile, Number of Observations, Analysis of Maximum Likelihood Estimates, Odds Ratio Estimates, and association statistics.
8. The EVENT= Option
For a binary endpoint, specifying the event explicitly makes the intended interpretation much easier to audit.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age;
run;
With a 0/1 response, event='1' states that the modeled event is response = 1. If the outcome is character-valued, the event can be specified using its character level when appropriate.
9. Reading the Maximum Likelihood Estimates Table
The parameter-estimates table is one of the central pieces of PROC LOGISTIC output.
| Column | What it tells you |
|---|---|
| Parameter | The model term being estimated. |
| Estimate | The estimated regression coefficient on the log-odds scale. |
| Standard Error | Estimated uncertainty of the coefficient. |
| Wald Chi-Square | Wald test statistic for the parameter. |
| Pr > ChiSq | Wald p-value for the parameter. |
The coefficient itself is not usually the most clinically intuitive quantity. For communication, the odds ratio with a confidence interval is often easier to interpret.
10. Requesting Odds Ratios Explicitly
PROC LOGISTIC can produce odds-ratio estimates directly using the ODDSRATIO statement.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
oddsratio treatment;
oddsratio age;
run;
For a continuous predictor, the default one-unit change may not be clinically meaningful. A one-year increase in age is interpretable, but a one-millimeter change in tumor burden may be less useful than a 10-mm increase.
11. Clinically Meaningful Units
Suppose the predictor is baseline tumor burden measured in millimeters. An OR per 1 mm may be statistically valid but difficult to communicate. You can rescale the predictor before modeling.
data oncology2;
set oncology;
burden10 = baseline_burden / 10;
run;
proc logistic data=oncology2;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age burden10;
oddsratio burden10;
run;
Now the OR for burden10 represents the change in odds associated with a 10-mm increase in baseline tumor burden.
12. Confidence Intervals
An odds ratio should normally be considered together with its confidence interval. If the interval excludes 1, the corresponding two-sided Wald test is consistent with statistical significance at the associated level, subject to the assumptions and method used.
For example, an estimated OR of 1.80 with a 95% CI of 1.20 to 2.70 suggests higher modeled-event odds and excludes the null value of 1.
| OR | 95% CI | Typical interpretation |
|---|---|---|
| 1.80 | 1.20–2.70 | Higher odds; interval excludes 1. |
| 0.65 | 0.45–0.94 | Lower odds; interval excludes 1. |
| 1.35 | 0.82–2.21 | Estimated higher odds, but interval includes 1. |
13. The Difference Between Odds and Risk
Logistic regression produces odds ratios. Odds ratios should not automatically be described as risk ratios or probability ratios.
For a rare outcome, odds and probability can be numerically similar. As the event becomes more common, they can differ substantially.
If response probability is 0.50, the odds are 1.00. If the probability is 0.80, the odds are 4.00. Thus a modest-looking probability difference can correspond to a larger odds difference.
14. Adjusted Versus Unadjusted Logistic Regression
A univariable model contains one predictor:
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment;
run;
An adjusted model includes additional prespecified covariates:
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') =
treatment
age
baseline_burden
performance_status;
run;
The treatment OR in the second model represents the treatment association conditional on the included covariates.
15. Continuous Covariates and Linearity in the Logit
One important logistic-regression assumption is that a continuous predictor has an appropriate functional form on the logit scale. This does not mean that the outcome probability must be linearly related to the predictor.
For example, a model with age as a single continuous term assumes:
If the true relationship is curved, a simple linear age term may be inadequate. Alternatives include prespecified transformations, polynomial terms, restricted cubic splines implemented through appropriate SAS modeling strategies, or categorization when scientifically justified.
16. Polynomial Terms
A simple quadratic extension is:
data oncology3;
set oncology2;
age2 = age*age;
run;
proc logistic data=oncology3;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age age2;
run;
The squared term changes the shape of the relationship. However, polynomial models can be difficult to interpret, so they should be motivated by the scientific question rather than added automatically.
17. Interactions
An interaction asks whether the association for one predictor depends on another predictor.
For example, a treatment-by-biomarker interaction can be specified with the bar notation:
proc logistic data=oncology;
class treatment (ref='Placebo') biomarker_group (ref='Low') / param=ref;
model response(event='1') =
treatment
biomarker_group
treatment*biomarker_group;
run;
A convenient shorthand is:
proc logistic data=oncology;
class treatment (ref='Placebo') biomarker_group (ref='Low') / param=ref;
model response(event='1') =
treatment|biomarker_group;
run;
The | notation expands into the main effects and interaction.
18. Predicted Probabilities
Predicted probabilities are often easier for clinical audiences to understand than log odds or odds ratios.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
output out=pred
p=predicted_prob
xbeta=linear_predictor;
run;
The P= option creates the predicted probability, while XBETA= stores the linear predictor.
| Variable | Concept |
|---|---|
predicted_prob | Estimated probability of the modeled event. |
linear_predictor | Estimated logit before transforming to a probability. |
19. From Log Odds to Probability
Suppose the fitted linear predictor for a patient is \eta=0.75.
The estimated event probability is therefore approximately 67.9%.
This illustrates why the coefficient scale can feel unintuitive: a change that is additive on the logit scale becomes nonlinear after conversion to probability.
20. Scoring New Patients
PROC LOGISTIC can also be used to generate predictions for new observations using the appropriate scoring workflow. A common approach is to save a fitted model and score a separate dataset.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
store work.logit_model;
run;
proc plm restore=work.logit_model;
score data=new_patients out=scored predicted=pred;
run;
The exact scoring workflow should be aligned with the SAS version, modeling options, formats, and production standards used by the project.
21. ROC Curves and AUC
When a logistic model is used for prediction or discrimination, the receiver operating characteristic curve is a common diagnostic display.
proc logistic data=oncology plots(only)=roc;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
run;
The area under the ROC curve, or AUC, summarizes discrimination across classification thresholds. An AUC of 0.5 corresponds to discrimination no better than chance in the usual binary-classification interpretation, while values closer to 1 indicate stronger ranking of events above non-events.
22. Classification Tables and Cutoffs
Logistic regression estimates probabilities. A classification rule converts those probabilities into predicted categories using a cutoff.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden
/ outroc=rocdata;
run;
Changing the cutoff changes sensitivity and specificity. Therefore, a classification table based on a particular cutoff should not be presented as an intrinsic property of the fitted logistic model.
23. Hosmer-Lemeshow-Type Goodness of Fit
For binary logistic models, PROC LOGISTIC can request a goodness-of-fit assessment using the lackfit option in the MODEL statement.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') =
treatment age baseline_burden
/ lackfit;
run;
Goodness-of-fit tests should be interpreted with care. Their behavior can depend on sample size, grouping, and model structure. They should be considered alongside calibration plots, residual diagnostics, influential observations, clinical plausibility, and external validation where relevant.
24. Influence and Diagnostic Measures
For a regression model intended for scientific or predictive use, influential observations deserve attention. PROC LOGISTIC provides options for requesting diagnostic output and plots.
Depending on the analysis, useful quantities can include residuals, leverage-related measures, influence diagnostics, and predicted probabilities.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') =
treatment age baseline_burden
/ influence iplots;
run;
The exact diagnostic output should be reviewed against the SAS version and the model specification. Diagnostics are most useful when they lead to a scientific question: Is this observation miscoded? Is it an extreme but valid patient? Is the model form inadequate? Is a small subgroup driving the result?
25. Separation
One of the most important logistic-regression problems is separation. Separation occurs when a predictor or combination of predictors nearly or completely distinguishes the outcome categories.
For example, imagine that every patient in one small treatment subgroup responds and every patient in another subgroup does not. The likelihood may favor extremely large parameter estimates.
Potential approaches include simplifying the model, combining clinically defensible categories, increasing sample size, using penalized methods where appropriate, or using exact logistic methods for selected small-sample problems.
26. Exact Logistic Regression
PROC LOGISTIC supports exact inference for selected logistic regression problems. Exact methods can be useful when samples are very small or data are sparse.
proc logistic data=small_data;
class exposure (ref='No') / param=ref;
model event(event='1') = exposure;
exact exposure / estimate=both;
run;
Exact methods can be computationally intensive. They should be selected because of the data structure and inferential objective, not simply because they are available.
27. Penalized Logistic Regression
When sparse data or separation is a concern, penalization may be preferable to an ordinary maximum-likelihood fit. The precise syntax and available options depend on the SAS release and modeling requirements.
In regulated or production environments, document why the penalized method was selected and ensure that the implementation is consistent with the statistical analysis plan and validation standards.
28. Model Selection
PROC LOGISTIC offers several model-selection approaches, including methods based on significance criteria or information criteria.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') =
treatment age baseline_burden biomarker performance_status
/ selection=backward;
run;
Other commonly encountered choices include forward selection, stepwise selection, and criteria based on AIC or related measures.
29. A Better Production Pattern for Adjusted Analyses
A more reviewable program typically defines the analysis population, derives variables, explicitly sets categorical reference groups, fits the prespecified model, saves output datasets where required, and documents the intended estimand.
/* Analysis population and derivations */
data adresp;
set source.adrs;
if analysis_flag='Y';
/* Example derived covariate */
burden10 = baseline_burden / 10;
run;
/* Primary logistic model */
proc logistic data=adresp;
class
treatment (ref='Placebo')
sex (ref='Female')
region (ref='Region 1')
/ param=ref;
model response(event='1') =
treatment
age
burden10
sex
region;
oddsratio treatment;
oddsratio age;
oddsratio burden10;
output out=pred
p=predicted_prob
xbeta=linear_predictor;
run;
This structure makes it easier for a programmer, statistician, reviewer, and validator to trace the analysis from source data to model output.
30. Binary, Ordinal, and Nominal Outcomes
PROC LOGISTIC is broader than binary logistic regression.
| Outcome type | Typical model | Key idea |
|---|---|---|
| Binary | Binary logistic regression | Two outcome categories. |
| Ordinal | Cumulative logit model | Ordered outcome categories. |
| Nominal with >2 categories | Generalized logit model | Categories have no natural order. |
31. Ordinal Logistic Regression
Suppose the endpoint is toxicity grade with ordered categories such as Grade 1, Grade 2, Grade 3, and Grade 4. The ordering contains information that should not automatically be discarded.
proc logistic data=toxicity;
class treatment (ref='Placebo') / param=ref;
model tox_grade(order=internal) =
treatment age
/ link=clogit;
run;
The cumulative logit model considers cumulative probabilities across the ordered categories. The interpretation of the OR depends on the direction of the ordering and the event/cutpoint convention.
32. Generalized Logit for Nominal Outcomes
If the outcome categories are nominal—for example, a three-category endpoint with no meaningful order—the generalized logit model can be used.
proc logistic data=endpoint;
class treatment (ref='Placebo') / param=ref;
model response = treatment age
/ link=glogit;
run;
SAS models the nonreference categories relative to a designated reference outcome. The output therefore contains multiple sets of coefficients and odds ratios.
33. Choosing the Outcome Coding Carefully
Before fitting a model, create a simple frequency table.
proc freq data=oncology;
tables response treatment response*treatment / missing;
run;
This simple step can reveal unexpected values, empty treatment-by-response cells, miscoding, and sparse subgroups before they create confusing logistic-regression output.
34. Missing Data
By default, observations with missing values needed for the specified model are not used in the likelihood calculation. Therefore, the analysis population can change as covariates are added.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') =
treatment
age
baseline_burden;
run;
Always inspect the Number of Observations table. If the unadjusted model uses 500 patients but the adjusted model uses 437, the difference should be understood and documented.
35. Complete-Case Analysis Is Not Automatically Harmless
Listwise deletion is simple, but whether it is appropriate depends on the missingness mechanism and the analysis objective. In clinical trials, missing covariates and missing outcomes can have different implications.
The logistic model itself does not solve missing-data problems. The missing-data strategy should be specified separately and implemented consistently with the statistical analysis plan.
36. Frequency Checks Before PROC LOGISTIC
37. A Practical PROC LOGISTIC Workflow
Endpoint + covariates
Counts + distributions
Model + CLASS + options
OR + CI + p-value
Fit + influence + ROC
Clinical interpretation
38. Type 3 Effects
When a predictor has multiple parameters—for example, a categorical variable with several levels—the Type 3 analysis evaluates the effect of the variable as a whole rather than testing only one parameter comparison.
proc logistic data=oncology;
class treatment region / param=ref;
model response(event='1') = treatment region age;
run;
For a multi-level categorical factor, this distinction matters. A single treatment-level OR answers a specific comparison, while the Type 3 test asks whether the factor contributes to the model as a whole.
39. Treatment Comparisons and Least-Squares Means
For more complicated models, especially models containing interactions, direct odds ratios can become difficult to interpret. Depending on the SAS release and model, effect estimates and contrasts can be requested using appropriate LSMEANS, LSMESTIMATE, or ODDSRATIO statements.
For example, when treatment interacts with a categorical biomarker, the clinically useful question may be the treatment comparison within each biomarker group rather than the raw main-effect coefficient.
proc logistic data=oncology;
class treatment biomarker_group / param=ref;
model response(event='1') =
treatment
biomarker_group
treatment*biomarker_group;
oddsratio treatment / at(biomarker_group=all);
run;
The exact syntax should be checked against the SAS version and desired estimand. In production programming, do not assume that a convenient-looking contrast corresponds exactly to the intended clinical comparison.
40. Reference Coding Can Change the Coefficients
Changing the reference category changes the numerical parameter estimates but does not change the underlying fitted model when the parameterization is otherwise equivalent.
/* Drug A versus Placebo */
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment;
run;
/* Placebo versus Drug A */
proc logistic data=oncology;
class treatment (ref='DrugA') / param=ref;
model response(event='1') = treatment;
run;
The corresponding ORs should be reciprocals when the comparison is reversed.
41. Formats and Labels
Readable output is important in clinical reporting. Formats can make model output easier to interpret, but they also affect how categories are displayed.
proc format;
value $trtfmt
'DrugA' = 'Drug A'
'Placebo' = 'Placebo';
run;
proc logistic data=oncology;
format treatment $trtfmt.;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age;
run;
42. ODS OUTPUT for Automated Reporting
For TLF development, it is often better to capture PROC LOGISTIC tables into SAS datasets rather than manually transcribing results.
ods output
ParameterEstimates = work.pe
OddsRatios = work.or
Type3 = work.type3;
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
run;
ods output close;
The exact ODS table names available can depend on the requested options and SAS release. During development, use ODS TRACE to identify the tables actually generated.
ods trace on;
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age;
run;
ods trace off;
43. Why ODS OUTPUT Matters in Regulated Work
Capturing output programmatically reduces transcription risk and creates a traceable path from analysis code to reportable values.
| Manual workflow | Programmatic workflow |
|---|---|
| Read value from output | Capture ODS table |
| Copy into table | Transform with SAS code |
| Risk of transcription error | Reproducible transformation |
| Harder to rerun | Easy to rerun after data updates |
44. A Reusable Macro Pattern
A macro can standardize recurring logistic-regression analyses, but it should not hide the statistical specification.
%macro run_logistic(data=, response=, predictors=);
proc logistic data=&data;
model &response(event='1') = &predictors;
run;
%mend;
%run_logistic(
data=oncology,
response=response,
predictors=age baseline_burden
);
For production code, a macro should include appropriate parameter validation, logging, documentation, and controlled handling of CLASS variables and reference levels.
45. Common Mistake: Treating a Binary Numeric Variable as Continuous
If a predictor has two categories, a 0/1 coding can mathematically represent a two-level effect. However, using the CLASS statement can make the intended categorical nature explicit and is generally preferable when the variable is conceptually categorical.
proc logistic data=oncology;
class smoker (ref='No') / param=ref;
model response(event='1') = smoker;
run;
46. Common Mistake: Forgetting the Event Direction
If response = 1 means success in one analysis but failure in another, the OR direction can reverse. This is one of the easiest logistic-regression mistakes to make and one of the most important to catch.
proc freq data=oncology;
tables response;
run;
proc logistic data=oncology;
model response(event='1') = treatment;
run;
Make the event definition explicit in both the code and the analysis documentation.
47. Common Mistake: Calling an OR a Relative Risk
A report that says "patients were 2.1 times more likely to respond" may be misleading if the actual estimate is an odds ratio. The wording should reflect the estimand.
A safer formulation is: "The estimated odds of response were 2.1 times higher."
48. Common Mistake: Interpreting a Main Effect in the Presence of an Interaction
If treatment interacts with biomarker status, the treatment coefficient for the reference biomarker group does not represent a universal treatment effect across all biomarker groups.
When an interaction is included, interpret the relevant simple effects or contrasts instead of presenting the main effect without qualification.
49. Common Mistake: Ignoring Sparse Categories
A categorical variable with ten levels may look reasonable in a data dictionary but be problematic if several levels contain only one or two patients.
proc freq data=oncology;
tables region*treatment*response / list missing;
run;
Small cells can lead to unstable estimates, wide confidence intervals, or separation.
50. Common Mistake: Overusing Automated Selection
Stepwise selection is attractive because it can produce a compact model. However, it can also capitalize on random variation and make inference less stable.
For confirmatory clinical-trial analyses, the model should generally be defined in advance. Exploratory selection can be useful for hypothesis generation, but it should be clearly labeled as exploratory.
51. A Complete Binary Logistic Regression Template
/*------------------------------------------------------------
Purpose:
Binary logistic regression for a clinical endpoint
Endpoint:
RESPONSE = 1 for event of interest, 0 otherwise
Model:
Treatment + prespecified baseline covariates
------------------------------------------------------------*/
proc logistic data=analysis;
class
treatment (ref='Placebo')
sex (ref='Female')
region (ref='Region 1')
/ param=ref;
model response(event='1') =
treatment
age
baseline_burden
sex
region
/ lackfit;
oddsratio treatment;
oddsratio age;
oddsratio baseline_burden;
output out=logistic_pred
p=predicted_probability
xbeta=linear_predictor;
run;
This is a useful starting template, but it should be adapted to the study's actual estimand, analysis population, missing-data rules, covariate definitions, and SAP.
52. Example Interpretation of a Treatment Effect
Suppose the final model gives the following treatment result:
| Comparison | OR | 95% CI | p-value |
|---|---|---|---|
| Drug A vs Placebo | 2.35 | 1.42–3.89 | 0.0008 |
A concise interpretation would be:
The exact wording should identify the endpoint and estimand. Avoid adding causal language unless the design and analysis support it.
53. Odds Ratios for Continuous Variables
Suppose age has an OR of 1.03 per year. The natural interpretation is a 3% multiplicative change in odds per one-year increase, holding other variables constant.
For a 10-year increase, the corresponding OR is:
Thus, under the model, a 10-year increase corresponds to approximately 34% higher odds, assuming the linear-logit relationship remains appropriate over that range.
54. Reporting Predicted Probabilities by Treatment
When a treatment comparison is adjusted for covariates, predicted probabilities can provide an intuitive companion to the OR.
For example, you might report model-based probabilities at representative covariate values or adjusted marginal estimates when the chosen estimand calls for them.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') = treatment age baseline_burden;
lsmeans treatment / ilink cl;
run;
Use these estimates only when their interpretation matches the intended estimand. A probability at the mean of all covariates is not automatically the same as a population-average treatment response probability.
55. Model Comparison
Nested logistic models can be compared using likelihood-based tests, while nonnested models may be evaluated using information criteria such as AIC. The appropriate comparison depends on the scientific question.
proc logistic data=oncology;
class treatment (ref='Placebo') / param=ref;
model response(event='1') =
treatment age baseline_burden
/ selection=none;
run;
In confirmatory work, model comparison should not become a post hoc search for a specification that produces the most favorable treatment result.
56. Sample Size and Events Per Variable
Logistic regression can become unstable when there are too few events relative to the complexity of the model. A simplistic fixed rule such as "10 events per variable" is not a universal law, but the underlying concern is real: sparse outcome information can produce unstable estimates.
Consider the number of events, non-events, categorical levels, interactions, and effective model degrees of freedom—not merely the total sample size.
57. Clinical-Trial Example: Objective Response
Imagine a randomized oncology trial with objective response as the binary endpoint. A typical adjusted analysis might include treatment and prespecified stratification or prognostic covariates.
proc logistic data=adresp;
class
trt01p (ref='Placebo')
strat1 (ref='Low')
strat2 (ref='No')
/ param=ref;
model response(event='1') =
trt01p
strat1
strat2;
oddsratio trt01p;
run;
The resulting treatment OR describes the modeled odds of response for the treatment comparison after accounting for the included covariates.
58. Clinical-Trial Example: Adverse Event
A binary safety endpoint can also be analyzed with logistic regression. For example, the outcome could be whether a patient experienced a treatment-emergent adverse event of a particular category during a defined period.
proc logistic data=adsafety;
class treatment (ref='Placebo') / param=ref;
model ae_grade3plus(event='1') =
treatment
age
sex
baseline_risk;
run;
For safety analyses, the event definition and observation window must be specified precisely. A logistic model cannot compensate for an ambiguously defined endpoint.
59. Clinical-Trial Example: Disease Control
Other binary endpoints, such as disease control at a prespecified assessment, can be handled similarly.
proc logistic data=adresp;
class treatment (ref='Placebo') / param=ref;
model disease_control(event='1') =
treatment
baseline_burden
age
performance_status;
run;
60. PROC LOGISTIC Versus PROC GENMOD
Both procedures can be used for models involving binary outcomes, but PROC LOGISTIC is particularly convenient when the primary interest is a standard logistic-regression model with odds ratios, classification, ROC analysis, and related logistic-specific output.
| Feature | PROC LOGISTIC | PROC GENMOD |
|---|---|---|
| Binary logistic regression | Yes | Yes |
| Odds-ratio-focused output | Strong | Available |
| ROC/AUC workflow | Strong | Not the primary focus |
| Generalized linear models | More specialized | Broad |
| Repeated/correlated binary data | Limited for standard use | GEE and related approaches |
The correct procedure depends on the estimand and data structure. Repeated binary observations from the same patient, for example, should not automatically be analyzed as independent observations simply because PROC LOGISTIC is convenient.
61. Repeated Binary Outcomes
If a patient contributes multiple correlated binary observations, standard PROC LOGISTIC assumes independence unless the analysis is otherwise structured to account for clustering. For longitudinal or clustered binary outcomes, consider methods designed for correlation, such as GEE or mixed-effects approaches, when appropriate.
62. Model Validation Checklist
| Check | Question |
|---|---|
| Endpoint | Is the event definition correct? |
| Population | Are the correct analysis flags and inclusion criteria used? |
| Reference levels | Are categorical reference groups explicit and correct? |
| Missingness | Why are observations excluded from the model? |
| Convergence | Did the model converge without problematic warnings? |
| Separation | Are estimates unstable because of sparse cells? |
| Functional form | Are continuous predictors appropriately modeled? |
| Interactions | Are interaction terms prespecified and interpreted correctly? |
| OR direction | Does the OR correspond to the intended comparison? |
| Confidence interval | Is the reported interval based on the intended method? |
| Output QC | Do counts and estimates reconcile with the source data? |
63. A Programmer's Debugging Strategy
When PROC LOGISTIC produces an unexpected result, avoid changing multiple things at once. Debug the model systematically.
PROC FREQ on the outcome.64. Interpreting the Output in the Right Order
A useful reading sequence is:
- Confirm the response profile and modeled event.
- Confirm the number of observations used.
- Review convergence and warnings.
- Review the global model tests.
- Review the parameter estimates.
- Review the odds ratios and confidence intervals.
- Review fit and diagnostic information.
- Translate the result into the clinical estimand and reporting language.
This order prevents a common mistake: jumping directly to the p-value without first checking what was actually modeled.
65. What PROC LOGISTIC Does Not Tell You Automatically
A logistic regression result does not by itself establish:
- Causality
- Clinical importance
- Good calibration
- External validity
- Correct model specification
- Absence of residual confounding
- Appropriate handling of missing data
- Correctness of the endpoint definition
The procedure performs the requested statistical computation. The scientific validity of the analysis depends on the design, data, assumptions, estimand, and prespecified methodology.
66. A Minimal Production Example
proc logistic data=analysis;
class treatment (ref='Placebo') / param=ref;
model response(event='1') =
treatment
age
baseline_burden;
oddsratio treatment;
oddsratio age;
oddsratio baseline_burden;
output out=pred
p=predicted_probability;
run;
This compact program is enough for many straightforward binary logistic analyses. Production work generally adds explicit population derivation, QC, ODS capture, diagnostic review, and reporting code.
67. A More Complete TLF-Oriented Pattern
ods output
ResponseProfile = resp_profile
ModelFit = model_fit
Type3 = type3
ParameterEstimates = parameter_estimates
OddsRatios = odds_ratios;
proc logistic data=analysis plots(only)=roc;
class
treatment (ref='Placebo')
sex (ref='Female')
region (ref='Region 1')
/ param=ref;
model response(event='1') =
treatment
age
baseline_burden
sex
region
/ lackfit;
oddsratio treatment;
oddsratio age;
oddsratio baseline_burden;
output out=pred
p=predicted_probability
xbeta=linear_predictor;
run;
ods output close;
During development, use ODS TRACE ON to verify table names and inspect the actual structure before building downstream reporting code.
68. Suggested Reporting Structure
A clinical table based on logistic regression commonly contains the treatment comparison, odds ratio, confidence interval, and p-value, along with the analysis population and endpoint definition.
| Statistic | Drug A | Placebo | OR (95% CI) | p-value |
|---|---|---|---|---|
| Responders | xx (xx.x%) | xx (xx.x%) | 2.35 (1.42, 3.89) | 0.0008 |
The actual shell and inferential method must follow the study's SAP and reporting specifications. Do not infer the table structure solely from the PROC LOGISTIC output.
69. Logistic Regression and Forest Plots
Odds ratios from multiple logistic models are often presented in forest plots. PROC LOGISTIC supplies the estimates; a separate reporting step can reshape those results into a plotting dataset.
/* Conceptual reporting dataset */
data forest;
set odds_ratios;
/* Derive labels, ordering, and display strings here */
run;
The key principle is to preserve the exact comparison, event definition, estimate, confidence interval, and analysis population when transforming model output for visualization.
70. Logistic Regression in Subgroup Analyses
Subgroup analyses require particular care because small subgroups can generate unstable estimates. A model run independently within each subgroup can produce wide intervals and convergence problems.
When the scientific question is whether treatment effects differ between subgroups, an interaction model is often more informative than a collection of isolated subgroup p-values.
proc logistic data=analysis;
class treatment (ref='Placebo') subgroup (ref='Reference') / param=ref;
model response(event='1') =
treatment
subgroup
treatment*subgroup;
run;
71. The Difference Between Statistical and Clinical Questions
The statistical model asks whether the observed data are compatible with specified parameter values under the model. The clinical question may be whether the magnitude of the treatment effect is meaningful for patients.
For example, an OR of 1.08 could be highly statistically significant in a very large dataset but clinically unimportant, while an OR of 2.0 with a very wide interval may warrant further investigation despite limited statistical precision.
72. Final Practical Checklist
73. Key Takeaways
- PROC LOGISTIC is the core SAS procedure for logistic regression.
- Binary logistic regression models the log odds of a specified event.
- Exponentiating a coefficient produces an odds ratio.
- Always verify the modeled event and response coding.
- Use CLASS explicitly for categorical predictors and define clinically meaningful reference groups.
- Do not call odds ratios risk ratios without justification.
- Interactions change how main effects should be interpreted.
- Predicted probabilities can make results easier to communicate.
- ROC/AUC evaluates discrimination, not overall model quality.
- Separation and sparse cells can make maximum-likelihood estimates unstable.
- Missing-data handling and covariate selection are analysis decisions, not automatic properties of PROC LOGISTIC.
- In clinical-trial programming, reproducibility, explicit specifications, ODS capture, and QC are as important as the model statement itself.
Conclusion
SAS PROC LOGISTIC is much more than a command that produces a p-value. It is a flexible framework for modeling binary and categorical clinical outcomes, estimating adjusted associations, generating odds ratios and predicted probabilities, evaluating discrimination, and producing model output that can feed reproducible clinical reporting.
The most reliable workflow is to begin with the clinical endpoint and estimand, verify the analysis population and coding, inspect the data, explicitly specify categorical reference levels, fit the prespecified model, evaluate its assumptions and diagnostics, and only then transform the results into tables or figures.