Programming the statistical procedures from SAS

PHREG scoring in production

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

PHREG scoring in production

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


Accepted Solutions
Solution
‎08-03-2016 11:41 AM
SAS Super FREQ
Posts: 3,310

Re: PHREG scoring in production

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


All Replies
Solution
‎08-03-2016 11:41 AM
SAS Super FREQ
Posts: 3,310

Re: PHREG scoring in production

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.

New Contributor
Posts: 2

Re: PHREG scoring in production

Thanks for posting the solution. 

Super Contributor
Posts: 399

Re: PHREG scoring in production

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

SAS Super FREQ
Posts: 3,310

Re: PHREG scoring in production

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

New User
Posts: 1

Re: PHREG scoring in production

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!   

SAS Super FREQ
Posts: 3,310

Re: PHREG scoring in production

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 254 views
  • 3 likes
  • 4 in conversation