BookmarkSubscribeRSS Feed
bikash10
Calcite | Level 5

Hello,

I have sas code to run the weibull survival model, and is running with out any errors. 

bikash10_0-1650312323456.png

I do have P_1 in my test data. When am trying to score the data, but it popped the warning message. 

bikash10_3-1650312633675.png

The error message is :

bikash10_2-1650312503156.png

I am not sure what's going on. Any suggestions are very helpful to score the data. 

 

Thank you,

Bikash

10 REPLIES 10
sbxkoenk
SAS Super FREQ

Hello,

 

What version of SAS are you using?

Submit :

%PUT &=sysvlong4;

to find out !

 

I believe you are running into a problem described by this problem note :
Problem Note 58685: Incorrect results are generated in the PLM procedure when it uses an item store that is generated by the LIFEREG or RELIABILITY procedures
https://support.sas.com/kb/58/685.html

 

BR,

Koen

bikash10
Calcite | Level 5

I checked the SAS version. It is SAS 9.04 version. 

bikash10_0-1650315486403.png

Thank you for your prompt reply. 

 

Sincerely,

Bikash

sbxkoenk
SAS Super FREQ

Hello,

 

Can you additionally run :

proc product_status; run;

?

 

For me , it says :

1    proc product_status; run;

For Base SAS Software ...
   Custom version information: 9.4_M7
   Image version information: 9.04.01M7P080520
For SAS/STAT ...
   Custom version information: 15.2

The problem note ( https://support.sas.com/kb/58/685.html ) claims this LIFEREG + PLM thing is fixed in SAS/STAT 14.2, but I wonder if that's correct? I think your SAS version (9.4 Maintenance Level 6) comes with SAS/STAT 15.1 (which is later than SAS/STAT 14.2).

 

Let me know ...

 

Thanks,

Koen

bikash10
Calcite | Level 5

I ran this code and got 15.1. Here is the details:

proc product_status; run;

 

bikash10_0-1650319149187.png

Thanks,

Bikash

Reeza
Super User

I generate the same error as you with PROC LIFEREG. 

Time to open a SAS Support ticket. Full code to reproduce is below:

 

title 'Motorette Failures With Operating Temperature as a Covariate';
data motors;
   input time censor temp @@;
   if _N_=1 then
      do;
         temp=130;
         time=.;
         control=1;
         z=1000/(273.2+temp);
         output;
         temp=150;
         time=.;
         control=1;
         z=1000/(273.2+temp);
         output;
      end;
   if temp>150;
   control=0;
   z=1000/(273.2+temp);
   output;
   datalines;
8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150
8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150
1764 1 170 2772 1 170 3444 1 170 3542 1 170 3780 1 170
4860 1 170 5196 1 170 5448 0 170 5448 0 170 5448 0 170
 408 1 190  408 1 190 1344 1 190 1344 1 190 1440 1 190
1680 0 190 1680 0 190 1680 0 190 1680 0 190 1680 0 190
 408 1 220  408 1 220  504 1 220  504 1 220  504 1 220
 528 0 220  528 0 220  528 0 220  528 0 220  528 0 220
;
proc print data=motors;
run;

proc lifereg data=motors;
model time*censor(0) = z / dist=lnormal;
store weibull_test;
run;

proc plm restore=weibull_test;
show program;
show parms;
run;

proc plm restore=weibull_test;
score data=motors out=motors_predicted  predicted;
run;

Log:

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         title 'Motorette Failures With Operating Temperature as a Covariate';
 70         data motors;
 71            input time censor temp @@;
 72            if _N_=1 then
 73               do;
 74                  temp=130;
 75                  time=.;
 76                  control=1;
 77                  z=1000/(273.2+temp);
 78                  output;
 79                  temp=150;
 80                  time=.;
 81                  control=1;
 82                  z=1000/(273.2+temp);
 83                  output;
 84               end;
 85            if temp>150;
 86            control=0;
 87            z=1000/(273.2+temp);
 88            output;
 89            datalines;
 
 NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
 NOTE: The data set WORK.MOTORS has 32 observations and 5 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              534.62k
       OS Memory           27556.00k
       Timestamp           04/18/2022 10:13:08 PM
       Step Count                        64  Switch Count  2
       Page Faults                       0
       Page Reclaims                     126
       Page Swaps                        0
       Voluntary Context Switches        12
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 98         ;
 
 99         proc print data=motors;
 100        run;
 
 NOTE: There were 32 observations read from the data set WORK.MOTORS.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.04 seconds
       user cpu time       0.05 seconds
       system cpu time     0.00 seconds
       memory              1197.00k
       OS Memory           27556.00k
       Timestamp           04/18/2022 10:13:08 PM
       Step Count                        65  Switch Count  0
       Page Faults                       0
       Page Reclaims                     70
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      10
       Block Input Operations            0
       Block Output Operations           16
       
 
 101        
 102        proc lifereg data=motors;
 103        model time*censor(0) = z ;
 104        store weibull_test;
 105        run;
 
 NOTE: Algorithm converged.
 NOTE: The LIFEREG procedure generated the model item store WORK.WEIBULL_TEST.
 NOTE: PROCEDURE LIFEREG used (Total process time):
       real time           0.05 seconds
       user cpu time       0.05 seconds
       system cpu time     0.00 seconds
       memory              1376.40k
       OS Memory           27816.00k
       Timestamp           04/18/2022 10:13:08 PM
       Step Count                        66  Switch Count  0
       Page Faults                       0
       Page Reclaims                     122
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      10
       Block Input Operations            0
       Block Output Operations           224
       
 
 106        
 107        proc plm restore=weibull_test;
 108        show program;
 109        show parms;
 110        run;
 
 NOTE: PROCEDURE PLM used (Total process time):
       real time           0.02 seconds
       user cpu time       0.03 seconds
       system cpu time     0.00 seconds
       memory              561.53k
       OS Memory           27556.00k
       Timestamp           04/18/2022 10:13:08 PM
       Step Count                        67  Switch Count  0
       Page Faults                       0
       Page Reclaims                     59
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      2
       Block Input Operations            0
       Block Output Operations           24
       
 
 111        
 112        proc plm restore=weibull_test;
 113        score data=motors out=motors_predicted  predicted;
 114        run;
 
 WARNING: The SCORE statement cannot be used for the specified model.
 NOTE: The data set WORK.MOTORS_PREDICTED has 0 observations and 0 variables.
 WARNING: Data set WORK.MOTORS_PREDICTED was not replaced because new file is incomplete.
 NOTE: PROCEDURE PLM used (Total process time):
       real time           0.01 seconds
       user cpu time       0.01 seconds
       system cpu time     0.00 seconds
       memory              708.34k
       OS Memory           28072.00k
       Timestamp           04/18/2022 10:13:08 PM
       Step Count                        68  Switch Count  0
       Page Faults                       0
       Page Reclaims                     85
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           16
       
 
 115        
 116        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 126          

Issue appears to be the same as @sbxkoenk identified, SCALE parameter is not stored on the model if you compare the outputs but it does say fixed and this is using a later version of SAS/STAT than indicated in the SAS Note. 

TomHsiung
Lapis Lazuli | Level 10

SAS version: SAS Viya for Learners.

 

Same error.

WARNING: The SCORE statement cannot be used for the specified model.

 

Codes:

proc lifereg data = albumin_iptw;
class sex
mv
rrt
hypertension
diabetes
copd
coronary_disease
albumin_used;
model time*mortality(0) = sex
age
sofa
inr
bun
lactate
glucose
albumin
mv
rrt
hypertension
diabetes
copd
coronary_disease
albumin_used 
/ distribution = weibull;
weight wt;
store out= w1;
run;

proc plm restore = w1;
score data = cov out= scored_predictions;
run;  

 

sbxkoenk
SAS Super FREQ

Hi,

 

I only have 2 minutes right now ... so my quick suggestion is to use the missing value trick for scoring a regression model.


The missing value trick for scoring a regression model - The DO Loop

 

The trick relies on two features of SAS software:

  • The first data set contains variables X and Y. The second contains only X. If the two data sets are concatenated, a missing value is assigned to Y for each value of X in the second data set.
  • When a regression procedure encounters an observation that has a missing value for the response variable, it does not use that observation to fit the model. However, provided that all of the explanatory variables are non-missing, the procedure does compute the predicted value for that observation.

Good luck,

Koen

TomHsiung
Lapis Lazuli | Level 10
Hello, Koen

Thank you so much for answering my question. Actually, I have experience with the method of DO Loop and it works. The drawback of the DO Loop is that it requires a lot of code lines, including DATA, PROC SQL, and PROC SGPLOT etc. But it indeed works.

Therefore, I tried to find some simpler ways to to so, like PROC PLM. Anyway, thanks again for your feedback.

Tom
Rick_SAS
SAS Super FREQ

 

Problem Note 58685 says:

Beginning in SAS 9.4 TS1M4 (SAS/STAT 14.2), PROC PLM does not support the CODE, EFFECTPLOT, or SCORE statements for an item store created in PROC LIFEREG or PROC RELIABILITY. If you specify one of these statements, the following warning message is issued accordingly:

WARNING:  The SCORE statement cannot be used for the specified model.
 
The OP is running 9.4M6, as are several responders. 
 
In addition, recent documentation for the STORE statement in PROC LIFEREG saysNote: The information that is stored by the STORE statement in PROC LIFEREG is a subset of what is usually stored by other procedures that implement this statement. Because only a subset of information is stored, postprocessing features of PROC PLM that use the CODE, EFFECTPLOT, and SCORE statements are not available for item stores that PROC LIFEREG creates.
 
In short, you can't use PROC PLM to score new data. Use the missing value trick instead: https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model.... 
TomHsiung
Lapis Lazuli | Level 10

Hi, Rick

 

Thanks for the clarification. Now I see. Luckily, there is the DO Loop method.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 10 replies
  • 1999 views
  • 12 likes
  • 5 in conversation