QTRSELECT Procedure

OUTPUT Statement

  • OUTPUT OUT=libref.data-table<COPYVARS=(variables)><keyword <=name>>…<keyword <=name>>;

The OUTPUT statement creates a data table that contains observationwise statistics, which are computed after the model is fitted. The variables in the input data table are not included in the output data table, in order to avoid data duplication for large data tables; however, variables that you specify in the COPYVARS= option are included.

The output statistics are computed based on the parameter estimates for the selected model. If you specify multiple quantile levels by using the QUANTILES option in the MODEL statement, then for each appropriate keyword that is specified in the OUTPUT statement, one variable is generated for each specified quantile level. For observations in which only the response variable is missing, predicted values are computed even though these observations do not affect the model fit. This enables, for example, predicted values to be computed for new observations.

You must specify the following option:

OUT=libref.data-table

names the output data table for PROC QTRSELECT to use. You must specify this option before any other options. libref.data-table is a two-level name, where

libref

refers to a collection of information that is defined in the LIBNAME statement and includes the library, which includes a path to where the data table is to be stored, and a session identifier, which defaults to the active session but which can be explicitly defined in the LIBNAME statement. For more information about libref, see the section Using CAS Sessions and CAS Engine Librefs.

data-table

specifies the name of the output data table.

You can also specify the following syntax elements:

COPYVAR=variable
COPYVARS=(variables)

transfers one or more variables from the input data table to the output data table.

keyword <=name>

specifies the statistics to include in the output data table and optionally names the new variables that contain the statistics. Specify a keyword for each desired statistic (see the following list of keywords), followed optionally by an equal sign and a variable to contain the statistic.

If you specify keyword=name, the new variable that contains the requested statistic has the specified name. If you omit the optional =name after a keyword, then a default name is used.

You can specify the following values for keyword to request statistics that are available with all selection methods:

PREDICTED<=name>
PRED<=name>
P<=name>

requests predicted values for the response variable. The default name is Pred.

RESIDUAL<=name>
RESID<=name>
R<=name>

requests the residual, calculated as ACTUAL – PREDICTED. The default name is Residual.

ROLE<=name>

requests a numeric variable that indicates the role played by each observation in fitting the model. The default name is _ROLE_. For each observation, the interpretation of this variable is shown in Table 6.

Table 6: Role Interpretation

Value Observation Role
0 Not used
1 Training
2 Validation
3 Testing


If you do not partition the input data by using a PARTITION statement, then the role variable value is 1 for observations used in fitting the model, and 0 for observations that have at least one missing or invalid value for the response, regressor, frequency, or weight variables.

If you specify multiple quantile levels by using the QUANTILES option in the MODEL statement, then for each appropriate keyword that is specified in the OUTPUT statement, one variable is generated for each specified quantile level. These variables appear in the same order as the specified quantile levels. For example, the following statements generate the mylib.out data table, which contains the two predicted quantile variables p1 and p2:

proc qtrselect data=mylib.one;
   model y = x1-x4 /quantiles=0.5 0.3;
   output out=mylib.out pred=p;
run;

The variable p1 is for quantile level 0.5, and the variable p2 is for quantile level 0.3.

By using the SORT suboption in the QUANTILES option, the following statements generate the mylib.out data table in sorted order:

proc qtrselect data=mylib.one;
   model y = x1-x4 /quantiles(sort)=0.5 0.3;
   output out=mylib.out pred=p;
run;

The variable p1 is for quantile level 0.3, and the variable p2 is for quantile level 0.5, because the sorted quantile levels are (0.3 0.5).

In addition to the preceding statistics, you can also use the keywords listed in Table 7 in the OUTPUT statement to obtain additional statistics. For computational formulas, see the section Diagnostic Statistics. All the statistics available in the OUTPUT statement are conditional on the selected model and do not take into account the variability introduced when you do model selection.

Table 7: Keywords for OUTPUT Statement

Keyword Description
LCLM Lower bound of a 100 left-parenthesis 1 minus alpha right-parenthesis% confidence interval for the
quantile prediction variable
STDP Standard error of the quantile prediction variable
UCLM Upper bound of a 100 left-parenthesis 1 minus alpha right-parenthesis% confidence interval for the
quantile prediction variable


Last updated: June 22, 2026