<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic PHREG log transformation in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PHREG-log-transformation/m-p/208523#M11268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: An illegal argument is used in the function call in statement number 1 at line 13&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; column 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The statement was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (13:1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logpreedin = LOG( preedin=0 )&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc phreg data=lchs.thesis_event;&lt;/P&gt;&lt;P&gt;class trimst: outcome;&lt;/P&gt;&lt;P&gt;logpreedin=log(preedin);&lt;/P&gt;&lt;P&gt;model time*pregint24(0)=depo bfeed outcome prev_unplanned logpreedin postedin prop_fps kept_ps sex_nocondom/ties=efron&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;assess var=(logpreedin) ph/resample;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Mar 2015 00:23:47 GMT</pubDate>
    <dc:creator>kli15</dc:creator>
    <dc:date>2015-03-24T00:23:47Z</dc:date>
    <item>
      <title>PHREG log transformation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PHREG-log-transformation/m-p/208523#M11268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: An illegal argument is used in the function call in statement number 1 at line 13&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; column 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The statement was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (13:1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logpreedin = LOG( preedin=0 )&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc phreg data=lchs.thesis_event;&lt;/P&gt;&lt;P&gt;class trimst: outcome;&lt;/P&gt;&lt;P&gt;logpreedin=log(preedin);&lt;/P&gt;&lt;P&gt;model time*pregint24(0)=depo bfeed outcome prev_unplanned logpreedin postedin prop_fps kept_ps sex_nocondom/ties=efron&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;assess var=(logpreedin) ph/resample;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 00:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PHREG-log-transformation/m-p/208523#M11268</guid>
      <dc:creator>kli15</dc:creator>
      <dc:date>2015-03-24T00:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: PHREG log transformation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PHREG-log-transformation/m-p/208524#M11269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Than,&lt;/P&gt;&lt;P&gt;I have two suggestions:&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jacob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 13:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PHREG-log-transformation/m-p/208524#M11269</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2015-03-24T13:18:01Z</dc:date>
    </item>
  </channel>
</rss>

