I have developed a COX model using SAS proc phreg procedure. I know how to score using the covariate using the proc procedure. How do I translate the model to simple sas code? if that is possible, then I would like to code it up in python so that it can be implemented on production platform.
Thanks,
Pradeep
The PHREG procedure supports the STORE statement, so I would use that statement to create an item store that contains the model. You can then use PROC PLM to score the model (use the SCORE statement in PROC PLM). This is shown about halfway through the article "Techniques for scoring a regression model in SAS."
If you prefer, the PLM procedure also supports the CODE statement (as described in the last section of the article), which you can use to write DATA step code that scores the model.
The PHREG procedure supports the STORE statement, so I would use that statement to create an item store that contains the model. You can then use PROC PLM to score the model (use the SCORE statement in PROC PLM). This is shown about halfway through the article "Techniques for scoring a regression model in SAS."
If you prefer, the PLM procedure also supports the CODE statement (as described in the last section of the article), which you can use to write DATA step code that scores the model.
Thanks for posting the solution.
Is there any differnece in scoring a model between PROC SCORE and SCORE statement in PROC PLM?
They will both give the same predicted values, but they work a little differently.
PROC SCORE uses parameter estimates that were saved to a SAS data set by the OUTEST= option of a regression procedure. PROC SCORE can be used to evaluate simple linear models. The syntax is extremely simple and the functionality is limited to forming predicted values.
In contrast, PROC PLM reads a model that was saved to an item store. It can score more complicated models, such as generalized linear models, mixed models, and survey regression models. In addition to scoring, PROC PLM supports many other post-modeling analyses, such as effect plots and custom hypothesis tests by using the ESTIMATE or LSMESTIMATE statements.
PROC SCORE is an older procedure. You can think of PROC PLM as "PROC SCORE on steroids"!
I too would like to see the equation needed to calculate predicted survival times from a Cox Proportional Hazards model I fit using PROC PHREG. I did not find the CODE statement to be an option here. PROC PHREG does not seem to support the CODE statement, only the STORE option. Can you confirm whether CODE is an option with Cox Proportional Hazards models as a way to see the formula needed to calcualte predicted survival times? Thanks!
right. You can use the STORE statement to save the model, then use the CODE statement or the SCORE statement in PROC PLM to score the model.
See the examples in the article "Techniques for scoring a regression model in SAS," which covers both statements.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.