BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pradark
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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.

View solution in original post

6 REPLIES 6
Rick_SAS
SAS Super FREQ

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.

pradark
Calcite | Level 5

Thanks for posting the solution. 

Babloo
Rhodochrosite | Level 12

Is there any differnece in scoring a model between PROC SCORE and SCORE statement in PROC PLM?

Rick_SAS
SAS Super FREQ

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"!

TmarNeustar
Calcite | Level 5

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!   

Rick_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 6 replies
  • 4850 views
  • 3 likes
  • 4 in conversation