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
alphaSpecifies the significance level for constructing all confidence intervals.
attributesChanges the attributes of variables used in this action.
classNames the classification variables to be used as explanatory variables in the analysis.
classGlobalOptsLists options that apply to all classification variables.
classLevelsPrintWhen set to False, suppresses the display of class levels.
clbWhen set to True, displays upper and lower confidence limits for the parameter estimates.
codeWrites SAS DATA step code for computing predicted values of the fitted model.
collectionDefines a set of variables that are treated as a single effect with multiple degrees of freedom.
corrBWhen set to True, displays the correlation matrix of the parameters.
covBWhen set to True, displays the covariance matrix of the parameters.
displaySpecifies a list of results tables to send to the client for display.
freqNames the numeric variable that contains the frequency of occurrence for each observation.
hessianWhen set to True, uses the analytical Hessian instead of the finite difference Hessian.
lassoRhoSpecifies the base regularization parameter for the LASSO method.
lassoStepsSpecifies the maximum number of steps for the LASSO method.
lassoTolSpecifies the convergence criterion for the LASSO method.
logLikeNullWhen set to True, displays the -2 log likelihood of the NULL model.
modelSpecifies the dependent variable, explanatory effects, and model options.
multimemberAllows an observation to be associated with multiple levels of a classification variable.
multipassWhen set to True, levelizes the input data table every time it is read.
nClassLevelsPrintLimits the display of class levels. A value of 0 suppresses all levels.
noStdErrWhen set to True, does not compute the covariance matrix or any statistic that depends on it.
optimizationSpecifies the technique and options for performing the optimization.
outputCreates a server-side table containing observation-wise statistics computed after fitting the model.
outputTablesLists the names of results tables to save as CAS tables on the server.
partByFracSpecifies the fractions of the data to be used for validation and testing.
partByVarNames the variable and its values to use for partitioning the data into training, validation, and testing roles.
polynomialSpecifies a polynomial effect. All variables must be numeric.
selectionSpecifies the method and options for performing model selection.
splineExpands variables into spline bases whose form depends on the specified parameters.
ss3When set to True, performs Type 3 effect tests.
strataNames the variable that identifies the strata for a stratified analysis.
strataMissingWhen set to True, allows missing values as valid STRATA variable values.
tableSpecifies the input data table.
weightNames 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?