The PHSELECT Procedure

CODE Statement

  • CODE <options>;

The CODE statement writes SAS DATA step code for computing predicted values of the fitted model to a file, to a catalog entry, or to a CAS table. The predicted values include survival probabilities and cumulative hazards at specific time points. To score new data, you can then include the file or the catalog entry in a DATA step, or you can specify the CAS table in the runCodeTable action in the dataStep action set (for more information, see SAS Viya: System Programming Guide).

Table 16.3 summarizes the options available in the CODE statement.

Table 16.3: CODE Statement Options

Option

Description

COMMENT

Adds comments to the generated code

CUMHAZ

Generates cumulative hazard values at specified time points

FILE=

Names the file in which to save the generated code

FORMATWIDTH=

Specifies the numeric format width for the regression coefficients

INDENTSIZE=

Specifies the number of spaces to indent the generated code

LABELID=

Specifies a number used to construct names and labels

LINESIZE=

Specifies the line size for the generated code

NOSURVIVAL

Suppresses the generation of survival probabilities

NOTRIM

Compares formatted values, including blank padding

OUT=

Names an output CAS table in which to save the generated code

SHOWTIME

Creates variables that contain the time points at which predictions are made

TIMEPOINT=

Specifies the time points at which survival probabilities or cumulative hazards are predicted


The following CODE statement options are particularly important:

CUMHAZ

generates SAS code to predict the cumulative hazard function at the time points that you specify in the TIMEPOINT= option.

FILE=filename

names the external file that saves the generated code. When enclosed in a quoted string (for example, FILE="c:mydirscorecode.sas"), this option specifies the path and filename for writing the code to an external file. If you do not specify a path but your SAS client has a default path, then the code is written to an external file named filename at that location. You can also specify an unquoted filename of no more than eight characters. If the filename is assigned as a fileref in a Base SAS FILENAME statement, the file specified in the FILENAME statement is opened; otherwise, if your SAS client has a default path, an external file named filename is created. This option cannot be specified with the OUT= option.

NOSURVIVAL

suppresses SAS code for survival probabilities prediction. If you do not specify this option, PROC PHSELECT generates SAS code to predict survival probabilities at the time points that you specify in the TIMEPOINT= option.

SHOWTIME

creates variables that contain the time points at which predictions are made. If T is the name of the failure time variable, these time point variables are named T_1, T_2, and so on.

TIMEPOINT=list | QUANTILE(probability-list)
TIME=list | QUANTILE(probability-list)

specifies the time points at which survival probabilities or cumulative hazards are predicted. You can specify a list of numbers that represent exact time points. For example:

code cumhaz timepoint = 40 to 60 by 10;

If T is the name of the failure time variable, the preceding specification requests the predicted cumulative hazard and survival probability at the time points T=40, T=50, and T=60. If you also specify the SHOWTIME option, these time points are saved in the variables T_1, T_2, and T_3, respectively. The predicted variables are named and labeled as shown in Table 16.4.

Table 16.4: Predicted Variables

T

Name

Label

40

C_T_1

Cumulative Hazard at T_1

50

C_T_2

Cumulative Hazard at T_2

60

C_T_3

Cumulative Hazard at T_3

40

S_T_1

Survival Probability at T_1

50

S_T_2

Survival Probability at T_2

60

S_T_3

Survival Probability at T_3


Alternatively, you can use the keyword QUANTILE to specify a list of quantile probabilities. For example:

 code timepoint = quantile(.2, .5, .8);

The PHSELECT procedure computes the 20th, 50th, and 80th percentiles from the Kaplan-Meier curve (or the Breslow curve if you also specify the ENTRY= option in the MODEL statement) and use them as the time points for the prediction.

By default, TIMEPOINT=QUANTILE(0.25, 0.50, 0.75).

For more information about the syntax of the CODE statement, see the section CODE Statement in Chapter 3: Shared Concepts.

Last updated: December 21, 2018