BookmarkSubscribeRSS Feed
kli15
Calcite | Level 5

Hello,

I'm using proc phreg to model several covariates of an outcome. The continuous variables need to be log transformed, but sometimes when I run the code it works while other times I get the following error:

ERROR: An illegal argument is used in the function call in statement number 1 at line 13

       column 1.

       The statement was:

    1     (13:1)     logpreedin = LOG( preedin=0 )

I get that I can't expect SAS to calculate the log of zero, but can someone explain to me why it sometimes shows outputs for both the model and assess statements with logpreedin and sometimes I get the above error?

Here's the code:

proc phreg data=lchs.thesis_event;

class trimst: outcome;

logpreedin=log(preedin);

model time*pregint24(0)=depo bfeed outcome prev_unplanned logpreedin postedin prop_fps kept_ps sex_nocondom/ties=efron;

assess var=(logpreedin) ph/resample;

run;

Than

1 REPLY 1
JacobSimonsen
Barite | Level 11

Hello Than,

I have two suggestions:

1) I think the only reason for why it sometimes Works and sometimes not is the random samples in the assessment. If you dont need to assess the functional form, then you shold omit the assessment statement, and the error will most likely disappear.

2) Also, since preedin is not timedependent, you should calculate logpreedin in a dataset before you run PHREG. Then, phreg will see logpreedin as any other fixed covariates, and the log-transformation will not be used in the assessment neithter (becase logpreedin is then already a transformed variable). Therefore, defining the logpredin in a dataset should also remove the error.

Good luck.

Jacob

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 1413 views
  • 0 likes
  • 2 in conversation