phreg

cox

Description

The `cox` action in the `phreg` (Proportional Hazards Regression) action set is used to fit Cox proportional hazards regression models. This statistical method is fundamental in survival analysis for investigating the relationship between the survival time of subjects and one or more predictor variables. The action can handle both continuous and categorical predictors, supports various methods for handling tied survival times, and includes robust model selection capabilities to help identify the most significant variables influencing survival.

phreg.cox <result=results> <status=rc> / alpha=double, attributes={{casinvardesc-1} <, {casinvardesc-2}, ...>}, class={{classStatement-1} <, {classStatement-2}, ...>}, classGlobalOpts={classopts}, classLevelsPrint=TRUE | FALSE, clb=TRUE | FALSE, code={coxCodegen}, collection={{collection-1} <, {collection-2}, ...>}, corrB=TRUE | FALSE, covB=TRUE | FALSE, display={displayTables}, freq="variable-name", hessian=TRUE | FALSE, lassoRho=double, lassoSteps=integer, lassoTol=double, logLikeNull=TRUE | FALSE, model={coxModel}, multimember={{multimember-1} <, {multimember-2}, ...>}, multipass=TRUE | FALSE, nClassLevelsPrint=integer, noStdErr=TRUE | FALSE, optimization={optimizationStatement}, output={coxOutputStatement}, outputTables={outputTables}, partByFrac={partByFracStatement}, partByVar={partByVarStatement}, polynomial={{polynomial-1} <, {polynomial-2}, ...>}, selection={selectionStatement}, spline={{spline-1} <, {spline-2}, ...>}, ss3=TRUE | FALSE, strata="variable-name", strataMissing=TRUE | FALSE, table={castable}, weight="variable-name" ;
Settings
ParameterDescription
alpha Specifies the significance level for constructing all confidence intervals.
attributes Changes the attributes of variables used in this action.
class Names the classification variables to be used as explanatory variables in the analysis.
classGlobalOpts Lists options that apply to all classification variables.
classLevelsPrint When set to False, suppresses the display of class levels.
clb When set to True, displays upper and lower confidence limits for the parameter estimates.
code Writes SAS DATA step code for computing predicted values of the fitted model.
collection Defines a set of variables that are treated as a single effect with multiple degrees of freedom.
corrB When set to True, displays the correlation matrix of the parameters.
covB When set to True, displays the covariance matrix of the parameters.
display Specifies a list of results tables to send to the client for display.
freq Names the numeric variable that contains the frequency of occurrence for each observation.
hessian When set to True, uses the analytical Hessian instead of the finite difference Hessian.
lassoRho Specifies the base regularization parameter for the LASSO method.
lassoSteps Specifies the maximum number of steps for the LASSO method.
lassoTol Specifies the convergence criterion for the LASSO method.
logLikeNull When set to True, displays the -2 log likelihood of the NULL model.
model Specifies the dependent variable, explanatory effects, and model options.
multimember Allows an observation to be associated with multiple levels of a classification variable.
multipass When set to True, levelizes the input data table every time it is read.
nClassLevelsPrint Limits the display of class levels. A value of 0 suppresses all levels.
noStdErr When set to True, does not compute the covariance matrix or any statistic that depends on it.
optimization Specifies the technique and options for performing the optimization.
output Creates a server-side table containing observation-wise statistics computed after fitting the model.
outputTables Lists the names of results tables to save as CAS tables on the server.
partByFrac Specifies the fractions of the data to be used for validation and testing.
partByVar Names the variable and its values to use for partitioning the data into training, validation, and testing roles.
polynomial Specifies a polynomial effect. All variables must be numeric.
selection Specifies the method and options for performing model selection.
spline Expands variables into spline bases whose form depends on the specified parameters.
ss3 When set to True, performs Type 3 effect tests.
strata Names the variable that identifies the strata for a stratified analysis.
strataMissing When set to True, allows missing values as valid STRATA variable values.
table Specifies the input data table.
weight Names the numeric variable to use for a weighted analysis.
Data Preparation View data prep sheet
Data Creation: Bone Marrow Transplant Data

This example uses data from a study on bone marrow transplants for leukemia patients. The data, stored in the `Bmt` table, includes patient survival time, censoring status, and various risk factors. This setup is typical for survival analysis.

Copied!
1DATA mycas.Bmt; SET sashelp.Bmt; RUN;

Examples

This example fits a simple Cox proportional hazards model. The survival time is defined by `T`, the censoring variable is `Status` (with event=1), and `Group` is the predictor. The `model` parameter specifies the survival time and censoring information, along with the explanatory variable.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 phreg.cox TABLE={name='Bmt'},
3 model={depVars={{name='T', event='Status(1)'}}, effects={{vars={'Group'}}}};
4RUN;
Result :
The output will include model information, data summary, and a table of parameter estimates for the 'Group' variable, showing its effect on the hazard rate.

This example demonstrates fitting a Cox model using a stepwise selection method to identify the most significant predictors from a set of candidates (`Group`, `Age`, `TA`, `DA`). The `selection` parameter is used to specify the method (`stepwise`) and the significance levels for entry (`slEntry`) and stay (`slStay`).

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 phreg.cox TABLE={name='Bmt'},
3 model={depVars={{name='T', event='Status(1)'}}, effects={{vars={'Group', 'Age', 'TA', 'DA'}}}},
4 selection={method='stepwise', slEntry=0.05, slStay=0.05};
5RUN;
Result :
The output will show the step-by-step process of variable selection, including which variables are added or removed at each step. The final results will include a summary of the selection process and the parameter estimates for the final selected model.

This example performs a stratified Cox regression. The analysis is stratified by the `Group` variable, meaning a separate baseline hazard function is estimated for each group. This is useful when the proportional hazards assumption does not hold for a categorical variable. `Age` and `TA` are included as covariates.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 phreg.cox TABLE={name='Bmt'},
3 strata='Group',
4 model={depVars={{name='T', event='Status(1)'}}, effects={{vars={'Age', 'TA'}}}};
5RUN;
Result :
The output will provide parameter estimates for `Age` and `TA`. It will also include a 'Stratification' table showing the levels of the `Group` variable used for stratification. No parameter estimate is computed for the `Group` variable itself, as its effect is absorbed into the baseline hazard.

FAQ

What is the primary purpose of the `phreg.cox` action?
What are the essential parameters to run a basic Cox regression model?
How do I handle censored data in the `cox` action?
What model selection methods are available in the `phreg.cox` action?
Can I perform a stratified Cox regression analysis?
How can I generate an output table with predicted values and residuals?
What is the purpose of the `ties` parameter in the `model` options?
How can I incorporate time-dependent covariates into my model?

Associated Scenarios

Use Case
Standard Survival Analysis for Clinical Drug Trial

A pharmaceutical company is conducting a clinical trial to evaluate the efficacy of a new drug compared to a placebo. The goal is to analyze the survival time of patients and de...

Use Case
High-Volume Variable Selection for Equipment Failure

A manufacturing plant wants to predict machine failure based on telemetry data. They collect dozens of sensor readings (temperature, vibration, pressure, etc.) but don't know wh...

Use Case
Stratified Churn Analysis with Ties Handling

A telecom provider analyzes customer churn. They suspect the baseline churn rate differs significantly between geographical regions (North, South, East, West), violating the pro...