BookmarkSubscribeRSS Feed
Dylan1
Calcite | Level 5

I used the PROC PHREG command to create a cox model. How then do I use the train and test split command in the proc phreg command. Or even the option of training the initial model on bootstrap samples.

3 REPLIES 3
Ksharp
Super User

I don't understand.
You could use TRAIN dataset to build a COX model. and using BASELINE statement to score a new dataset. Like:

data test;
format gender gender.;
input gender age;
datalines;
0 69.845947
1 69.845947
;
run;

proc phreg data = train plots(overlay)=(survival);
class gender;
model lenfol*fstat(0) = gender age;
baseline covariates=test out=base / rowid=gender;
run;



https://stats.oarc.ucla.edu/sas/seminars/sas-survival/

SAS_Rob
SAS Employee

PHREG does not have any options to create test/train data sets or employ bootstrap resampling methods directly.  You would need to create them prior to running the procedure.

 

The issue, which was mentioned previously, is that PH models cannot truly be used to extrapolate beyond the time range of the data that the model was built upon.  Trying to automate the process of creating test and train data sets is difficult for that reason--your validation data set would need to have the identical time range as the data set you used to build the model.

JacobSimonsen
Barite | Level 11

Train and test data is relevant for prediction. Then it is probably not a Cox model you want to fit, as the Cox model does not predict anything. It only estimate the hazard rate ratios.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 454 views
  • 2 likes
  • 4 in conversation