Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
Modelling in SAS means fitting a statistical model with a procedure whose MODEL statement names the outcome on the left and the predictors on the right: PROC REG for a continuous outcome and PROC LOGISTIC for a binary, ordinal or nominal one. Both share the same statement shape, so once you have run one regression you already know how to write the other. This guide walks through both, shows how to read the output tables, and lists the documented pitfalls.
Ask CASRAI · free to tryQuestion about this guide? Ask CASRAI answers with linked sources. 2 free questions a day, no account.
What modelling in SAS is used for in research
In research analysis, “modelling” in SAS usually means regression: estimating how an outcome changes with one or more predictors, then testing whether those relationships are distinguishable from zero. The SAS/STAT regression chapters split the work by outcome type. PROC REG fits linear regression models, and the SAS/STAT introduction to regression procedures describes it as providing “the most extensive analysis capabilities for linear regression models involving individual numeric independent variables”. PROC GLM has many of the same input and output capabilities but, per the same chapter, does not provide as many diagnostic tools. PROC LOGISTIC fits logistic regression models and estimates parameters by maximum likelihood; it handles binary responses, cumulative-link ordinal responses (the proportional odds model) and generalized-logit nominal responses, with variable selection methods and conditional and exact conditional logistic regression also available.
The table below is the quick decision aid this guide uses. It is built only from the SAS documentation cited in the Sources section.
| Your outcome | Procedure the documentation points to | Model type |
|---|---|---|
| Continuous (for example weight) | PROC REG (or PROC GLM) |
Linear regression |
| Binary (event or no event) | PROC LOGISTIC |
Binary logistic regression |
| Ordered categories | PROC LOGISTIC |
Cumulative-link (proportional odds) model |
| Unordered categories | PROC LOGISTIC |
Generalized logit model |
If your question is a comparison of group means rather than a regression, see the separate guide on ANOVA in SAS. For a platform-level overview of the product family, see SAS statistical software for research.
Install or access SAS
You do not need a local installation to follow this guide. SAS describes SAS OnDemand for Academics as “a free, cloud-based learning environment that provides access to SAS software for teaching and learning analytics”, used in a browser or through the Enterprise Guide app without installing or managing software locally. SAS states that students, educators and independent learners can use SAS Studio, and that learners who are not using it for a class can get free access to SAS OnDemand for Academics: Studio for learning purposes. Students in a class register with the code their instructor provides, and the starting point is the “Access now” link on SAS’s university page (welcome.oda.sas.com). For how academic access fits alongside institutional licences, see SAS academic access.
Before modelling your own data you also need to get it into SAS; the guide on PROC IMPORT in SAS covers that step. The examples below use data sets that SAS itself documents, so you can run them as written.
Step-by-step: fit a linear model with PROC REG
The general form of the MODEL statement in PROC REG, as written in the SAS/STAT syntax reference, is MODEL dependents = regressors / options; (the label, the regressors and the options are each optional). The SAS/STAT getting-started example regresses weight on height in the Class data set that ships in the Sashelp library, so it needs no import.
- Open a SAS program window (SAS Studio in SAS OnDemand for Academics works).
- Turn on ODS graphics so that the diagnostic plots are produced, and name the data set:
ods graphics on; - Call the procedure with the data set:
proc reg data=sashelp.class; - Write the model with the outcome on the left:
model Weight = Height; - End the step and run it:
run;
Together, the program is:
ods graphics on;proc reg data=sashelp.class; model Weight = Height;run;
To add predictors, list them after the equals sign separated by spaces. One documented restriction matters for polynomial models: if you want a quadratic term for a variable X1, you cannot write X1*X1 in the MODEL statement. Create a new variable for the squared term in a DATA step first and name that variable in MODEL.
Choosing variables automatically with SELECTION=
The MODEL statement accepts a SELECTION= option. The documented values are FORWARD (or F), BACKWARD (or B), STEPWISE, MAXR, MINR, RSQUARE, ADJRSQ, CP, or NONE, which uses the full model and is the default. Entry and stay significance levels are set with SLENTRY= (alias SLE=) and SLSTAY= (alias SLS=); the data table below lists the documented defaults. For example, model y = x1 x2 x3 / selection=stepwise; requests stepwise selection at the default levels. The documentation also shows that braces group variables that must enter and leave together, as in model y={x1 x2} x3 / selection=stepwise groupnames='x1 x2' 'x3';.
Step-by-step: fit a logistic model with PROC LOGISTIC
SAS notes that the MODEL statement in PROC LOGISTIC is similar to the one used in PROC REG. The minimal form from the getting-started chapter is:
proc logistic; model y = x1 x2;run;
Two response layouts are documented. With grouped data, write model r/n = x1 x2; where n is the number of trials and r the number of events. With one record per observation, name the response and state which level counts as the event, as in model NotReady(event='1') = Heat Soak;, with a freq Freq; statement when a frequency variable carries the counts.
- Decide whether your data are grouped (events out of trials) or one row per subject.
- Write the
MODELstatement in the matching form. - Name the event level explicitly with the
EVENT=response option rather than relying on the default (see Troubleshooting). - Run the step and read the tables described in the next section.
The SAS getting-started example uses the ingots data (heating and soaking times for ingots and whether each was ready for rolling). It first fits an interaction model and then the main-effects model:
ods graphics on;proc logistic data=ingots; model r/n = Heat | Soak; oddsratio Heat / at(Soak=1 2 3 4);run;proc logistic data=ingots; model r/n = Heat Soak;run;
The ingots data are created in the SAS documentation example itself; copy that DATA step from the getting-started page cited under Sources before running the code.
Output and how to read it
PROC REG output
The PROC REG example produces an Analysis of Variance table and a Parameter Estimates table. In the documented weight-on-height run, the overall model F statistic is highly significant (F = 57.076, p below 0.0001). The Root MSE is an estimate of the standard deviation of the error term, and the R-square of 0.77 indicates that Height accounts for 77% of the variation in Weight. The Parameter Estimates table adds t statistics and p-values; both the intercept and the Height estimate are highly significant, and the fitted model is Weight = -143.0 + 3.9 × Height.
PROC LOGISTIC output
The documented output sections are, in order of use:
- Model Information and Response Profile: confirm which data set, response and levels the procedure used. Check this first, because it shows which level is being modelled.
- Model Fit Statistics: AIC, SC and -2 Log L. SAS states that AIC and SC can be used to compare different models, and the ones with smaller values are preferred.
- Testing Global Null Hypothesis: BETA=0: likelihood ratio, score and Wald tests. In the example, small p-values reject the hypothesis that all slope parameters equal zero.
- Analysis of Maximum Likelihood Estimates: the coefficients and their p-values.
- Odds Ratio Estimates with 95% Wald confidence limits.
- Association of Predicted Probabilities and Observed Responses: Somers’ D, Gamma, Tau-a and c.
The main-effects results in the SAS example show how to read an odds ratio against its interval:
| Term | Estimate | Pr > ChiSq | Odds ratio | 95% Wald limits |
|---|---|---|---|---|
| Heat | 0.0820 | 0.0005 | 1.085 | 1.036 to 1.137 |
| Soak | 0.0568 | 0.8639 | 1.058 | 0.553 to 2.026 |
The Heat interval excludes 1 and its p-value is small, so the effect is distinguishable from no effect at conventional levels. The Soak interval includes 1 and its p-value is 0.8639, so it is not. In the interaction model the Heat*Soak term had p = 0.7270, which the documentation describes as not significant, which is why the example moves to the main-effects model. For plain-language definitions of the quantities involved, see the dictionary entries on the odds ratio and the confidence interval.
Troubleshooting
The odds ratios point the wrong way
By default, Ordered Values are assigned to the sorted response values in ascending order, and PROC LOGISTIC models the probability of the response level that corresponds to Ordered Value 1. If your event is coded so that it sorts second, the procedure models the opposite of what you intended. Use the EVENT= response option, as in model NotReady(event='1') = Heat Soak;, and confirm the result in the Response Profile table. ORDER= also controls how levels are ordered.
Error or warning about a squared term in PROC REG
Do not write X1*X1 in PROC REG‘s MODEL statement. Build the quadratic variable in a DATA step and use it as a regressor.
Stepwise selection keeps or drops too many variables
The entry and stay levels have method-specific defaults: 0.50 for FORWARD entry, 0.15 for STEPWISE entry and stay, and 0.10 for BACKWARD stay. If the defaults do not suit your analysis plan, set SLENTRY= and SLSTAY= explicitly and report them with your results.
Grouped data produce unexpected counts
For events-over-trials data, use the r/n form with n as trials and r as events; for one-row-per-observation data with counts in a variable, add a FREQ statement.
Free alternatives
If you do not have SAS, the same two models can be fitted elsewhere. The table lists only what each project’s own documentation says.
| Tool | Function documented | What the documentation says |
|---|---|---|
| SAS OnDemand for Academics | PROC REG, PROC LOGISTIC |
Free cloud-based learning environment for students, educators and independent learners; runs in a browser |
| R (stats package) | glm |
“glm is used to fit generalized linear models, specified by giving a symbolic description of the linear predictor”; the family argument describes the error distribution and link function, and for binomial families the response can be a factor or a two-column matrix |
| Python statsmodels | OLS, Logit |
OLS is listed as Ordinary Least Squares for linear models; its discrete-models module covers regression models for limited and qualitative dependent variables, including binary Logit and Probit |
The R row also mirrors the SAS grouped-data layout: a two-column response matrix plays the role of the events-out-of-trials form.
Frequently asked questions
Which SAS procedure should I use to model a binary outcome?
Use PROC LOGISTIC. It fits logistic regression models by maximum likelihood and handles binary responses as well as ordinal (cumulative-link, proportional odds) and nominal (generalized logit) responses.
How do I change which level of the response PROC LOGISTIC models?
By default it models the response level with Ordered Value 1. Use the EVENT= response option, for example model NotReady(event='1') = Heat Soak;, and check the Response Profile table to confirm.
What is the difference between PROC REG and PROC GLM?
SAS/STAT states that PROC GLM has many of the same input and output capabilities as PROC REG but does not provide as many diagnostic tools, while PROC REG has the most extensive analysis capabilities for linear models with individual numeric independent variables.
Can I practise SAS modelling for free?
Yes, for learning. SAS states that SAS OnDemand for Academics is a free, cloud-based learning environment, and that independent learners can get free access to its Studio for learning purposes.
Sources
All pages read 2026-11-14. SAS/STAT documentation is cited from the SAS/STAT User’s Guide sets hosted at support.sas.com.
- SAS/STAT, PROC REG MODEL statement: support.sas.com, statug_reg_syntax08
- SAS/STAT, Getting Started: PROC REG, Simple Linear Regression: support.sas.com, statug_reg_gettingstarted01
- SAS/STAT, Getting Started: PROC LOGISTIC: support.sas.com, statug_logistic_gettingstarted
- SAS/STAT, Introduction to Regression Procedures: support.sas.com, statug_introreg_sect014
- SAS OnDemand for Academics: sas.com, SAS OnDemand for Academics
- R documentation,
glm: stat.ethz.ch - statsmodels documentation: regression and discrete models
Data: PROC REG MODEL statement: SELECTION= methods and default significance levels
Variable-selection methods documented for the PROC REG MODEL statement in the SAS/STAT User's Guide, with the default SLENTRY= and SLSTAY= significance levels the documentation states for each method. Compiled from the SAS/STAT syntax reference.
| SELECTION= value | Default SLENTRY (entry level) | Default SLSTAY (stay level) | Note |
|---|---|---|---|
| FORWARD (or F) | 0.5 | not applicable | Adds variables stepwise-forward; SLENTRY default 0.50 |
| BACKWARD (or B) | not applicable | 0.1 | Removes variables; SLSTAY default 0.10 |
| STEPWISE | 0.15 | 0.15 | Entry and stay both default to 0.15 |
| NONE | not applicable | not applicable | Uses the full model; this is the default SELECTION= value |
Sources
- SAS/STAT User's Guide: PROC REG, MODEL Statement (accessed 2026-11-14)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







