LOGSELECT Procedure

MODEL Statement

  • MODEL response <(response-options)> = <effects> </ model-options>;

  • MODEL events / trials = <effects> </ model-options>;

  • MODEL response-level1 response-level2 <…response-levelJ> = <effects> </ model-options>;

The MODEL statement defines the statistical model in terms of a response or target, model effects that are constructed from variables in the input data table, and model-options. An intercept is included in the model by default. You can remove the intercept by specifying the NOINT option.

Three forms of the response can be specified. For the first form, single-trial syntax, you can specify a single response variable that contains your response values. Single-trial syntax is used when each observation in the DATA= data table contains information about only a single trial, such as a single subject in an experiment, and is applicable to binary, ordinal, and nominal response data.

The second form, events/trials syntax, is applicable to binomial response data, where one variable contains the number of positive responses (or events) and another variable contains the number of trials. Note that the values of both events and (trialsevents) must be nonnegative and the value of trials must be positive.

The third form, multinomial-trial syntax, is used when each observation contains information about multiple trials, and you have one variable (response-level1) that contains the number of responses in the first level, another variable (response-level2) that contains the number of responses in the second level, and so on. The last level in the response-level list is the reference level. Multinomial-trial syntax is applicable to binomial, ordinal, and nominal response data. Note that the values of the response-level1 through response-levelJ variables must be nonnegative.

For information about constructing the model effects, see the section Specification and Parameterization of Model Effects in Chapter 2, Shared Concepts.

There are two sets of options in the MODEL statement. The response-options determine how the LOGSELECT procedure models probabilities for binary and multinomial data when you use single-trial syntax. The model-options control other aspects of model formation and inference. Table 7 summarizes these options.

Table 7: MODEL Statement Options

Option Description
Response Variable Options
DESCENDING Reverses the response categories
EVENT= Specifies the event category
ORDER= Specifies the sort order
REF= Specifies the reference category
Model Options
CENTER Centers and scales continuous main effects
CENTERLASSO Centers and scales all effects for model selection by the LASSO method and the elastic net method
CLB Requests Wald confidence limits
INCLUDE= Includes effects in all models for model selection
INFORMATIVE Models missing values by using extra indicator variables
LINK= Specifies the link function
NOINT Suppresses the intercept
OFFSET= Specifies the offset variable
PRIOR= Specifies prior probabilities
START= Includes effects in the initial model for model selection
TYPE3 Displays the Type 3 or joint tests of effects


Response Variable Options

Response variable options determine how the LOGSELECT procedure models probabilities for binary and multinomial response data when you specify single-trial syntax. You can specify the following response-options by enclosing them in parentheses after the response or trials variable. These options are not available with multinomial-trial syntax.

DESCENDING
DESC

reverses the order of the response categories. If you specify both the DESCENDING and ORDER= options, PROC LOGSELECT orders the response categories according to the ORDER= option and then reverses that order.

EVENT='category' | FIRST | LAST

specifies the event category for the binary response model. PROC LOGSELECT models the probability of the event category. The EVENT= option has no effect when there are more than two response categories.

You can specify one of the following:

'category'

specifies the value (formatted, if a format is applied) of the event category in quotation marks.

FIRST

designates the first ordered category as the event.

LAST

designates the last ordered category as the event.

By default, EVENT=FIRST.

For example, the following statements specify that observations with the formatted value '1' represent events in the data. The probability that the LOGSELECT procedure models is thus the probability that the variable def takes on the (formatted) value '1'.

proc logselect data=mylib.MyData;
   class A B C;
   model def(event ='1') = A B C x1 x2 x3;
run;
ORDER=FORMATTED | FREQ | INTERNAL | 'level1' 'level2' …

specifies the sort order for the levels of the response variable. When ORDER=FORMATTED for numeric variables for which you have supplied no explicit format (that is, for which there is no corresponding FORMAT statement in the current PROC LOGSELECT run or in the DATA step that created the data table), the levels are ordered by their internal (numeric) value. The following table shows how to interpret the ORDER= keywords:

ORDER= Levels Sorted By
FORMATTED External formatted value, except for numeric variables with no explicit format, which are sorted by their unformatted (internal) value; the sort order is machine-dependent.
FREQ Descending frequency count (levels with the most observations come first in the order)
INTERNAL Unformatted value; the sort order is machine-dependent.

By default, ORDER=FORMATTED.

You can also specify a particular order for the response variable by listing the levels in quotes in the desired order. For example:

model pet(order = 'dog' 'cat') = ...;

Any level of the pet variable that you do not specify is added to the end of the list in formatted order.

The ORDER= option does not apply to missing values, which are always ordered first.

For more information about sort order, see the chapter on the SORT procedure in the Base SAS Procedures Guide and the discussion of BY-group processing in SAS Programmers Guide: Essentials.

REF='category' | FIRST | LAST

specifies the reference category for the generalized logit model and the binary response model. For the generalized logit model, each logit contrasts a nonreference category with the reference category. For the binary response model, specifying one response category as the reference is the same as specifying the other response category as the event. You can specify one of the following:

'category'

specifies the value (formatted, if a format is applied) of the reference category in quotation marks.

FIRST

designates the first ordered category as the reference.

LAST

designates the last ordered category as the reference.

By default, REF=LAST.

Model Options

CENTER

requests that continuous main effects be centered and scaled internally. (Continuous main effects are centered and scaled to aid in computing maximum likelihood estimates.) Parameter estimates and related statistics are always reported on the original scale. This option has no effect if you specify the LASSO model selection method or the elastic net selection method; instead, you should specify the CENTERLASSO option.

CENTERLASSO<=TRUE | FALSE>

specifies whether all effects, including categorical effects, are centered and scaled internally for the LASSO model selection method or the elastic net selection method. (Effects are centered and scaled to aid in model selection by the LASSO method and the elastic net method.) Parameter estimates and related statistics are always reported on the original scale. By default, CENTERLASSO=TRUE.

CLB

displays Wald confidence limits for each of the parameter estimates. The confidence level is 0.95 by default; you can change it by specifying the ALPHA= option. The CLB option is not available when you use either LASSO selection or elastic net selection.

INCLUDE=n
INCLUDE=single-effect
INCLUDE=(effect-list)

forces effects to be included in all models. If you specify INCLUDE=n, then the first n effects that are listed in the MODEL statement are included in all models. If you specify INCLUDE=single-effect or if you specify INCLUDE=(effect-list), then the specified effects are forced into all models. The effects that you specify in this option must be explanatory effects that are specified in the MODEL statement before the slash (/). This option is not available if you use elastic net selection.

INFORMATIVE

models missing values by using extra model effects. These effects consist of dummy variables that take the value 1 when the value of a continuous model variable involved in the effect is missing, and take the value 0 otherwise. The missing value in the original model effect is replaced by the average value of the effect for the nonmissing values. For continuous-by-class effects, such as A*x, where A is a classification variable and x is a continuous variable, informative missingness creates multiple dummy columns and substitutes the effect mean of x that corresponds to the respective level of A. Missing values for classification variables are treated as valid levels. For more information about informative missingness, see the section Informative Missingness in Chapter 2, Shared Concepts.

LINK=keyword

specifies the link function for the model. The default link is the logit. The keywords and the associated link functions are shown in Table 8.


For the probit and cumulative probit links, normal upper Phi Superscript negative 1 Baseline left-parenthesis dot right-parenthesis denotes the quantile function of the standard normal distribution.

If the response variable has more than two categories, the LOGSELECT procedure fits a model that has a cumulative link function that is based on the specified link. However, if you specify LINK=GLOGIT, the procedure assumes a generalized logit model for nominal (unordered) data.

NOINT

requests that no intercept be included in the model. An intercept is included by default. The NOINT option is not available for multinomial models.

OFFSET=variable

specifies a variable to be used as an offset to the linear predictor. An offset plays the role of an effect whose coefficient is known to be 1. The offset variable cannot appear in the CLASS statement or elsewhere in the MODEL statement. Observations that have missing values for the offset variable are excluded from the analysis.

PRIOR=number | number-list

specifies prior probabilities (prevalences) that are used for computing posterior predicted probabilities. When you know what percentage of the population has a rare event and you oversample that rare event, specifying the prior probabilities as the prevalence of events in your population enables you to produce posterior probabilities that reflect the population, not the data. The priors do not affect the model-fitting process.

If you specify a number-list that has the same number of entries as there are response levels, then these values are scaled to sum to 1. If you specify a number-list that has one entry less than there are response levels, then the specified values should sum to less than 1, and the last response level is assigned the remaining value. For binary and binomial response models, you can thus specify the probability of an event as a single number. The scaled priors are displayed in the ResponseProfile table.

If your response Y takes values i equals 1 comma ellipsis comma k that have observed empirical training probabilities normal upper O normal l normal d normal upper P normal r normal i normal o normal r Subscript i Baseline equals StartFraction n Subscript i Baseline Over n EndFraction, you specify priors normal upper P normal r normal i normal o normal r Subscript i, and your model predicted probabilities are ModifyingAbove p With caret Subscript i, then the posterior predicted probabilities normal upper P normal o normal s normal t Subscript i are computed as

normal upper P normal o normal s normal t Subscript i Baseline equals StartStartFraction ModifyingAbove p With caret Subscript i Baseline StartFraction normal upper P normal r normal i normal o normal r Subscript i Baseline Over normal upper O normal l normal d normal upper P normal r normal i normal o normal r Subscript i Baseline EndFraction OverOver sigma-summation Underscript j equals 1 Overscript k Endscripts ModifyingAbove p With caret Subscript j Baseline StartFraction normal upper P normal r normal i normal o normal r Subscript j Baseline Over normal upper O normal l normal d normal upper P normal r normal i normal o normal r Subscript j Baseline EndFraction EndEndFraction

The POST= option in the OUTPUT statement writes the posterior to the output data table. If your priors are identical to the empirical probabilities, then the posteriors are identical to the model-predicted probabilities.

The priors adjust the "Classification" table statistics PPV, NPV, adequacy, percentage correct, misclassification rate, and lift as discussed in the section Classification Table and ROC Curves. If you specify a PARTITION statement, then the posterior probabilities and the preceding statistics for the validation and test data also use the specified priors.

START=n
START=single-effect
START=(effects)

begins the selection process from the designated initial model for the forward and stepwise selection methods. If you specify START=n, then the starting model includes the first n effects that are listed in the MODEL statement. If you specify START=single-effect or if you specify START=(effects), then the starting model includes those specified effects. The effects that you specify in the START= option must be explanatory effects that are specified in the MODEL statement before the slash (/). This option is not available when you specify METHOD=BACKWARD in the SELECTION statement or when you specify METHOD=ELASTICNET in the SELECTION statement.

TYPE3

computes Wald statistics for Type 3 contrasts for each effect that is specified in the MODEL statement. This option is not available when you specify a REPEATED statement. For more information, see the section Joint Tests and Type 3 Tests.

Last updated: June 22, 2026