<?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 evaluating logarithm using %sysevalf in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27728#M5123</link>
    <description>I'm writing a SAS macro which includes a proc sql. Within the proc sql, I need to take a logarithm. I tried doing so using:&lt;BR /&gt;
 &lt;BR /&gt;
%let DDenom=%sysevalf(log(&amp;amp;ProbBad/&amp;amp;ProbGood));&lt;BR /&gt;
 &lt;BR /&gt;
and receive the following error when the macro runs: &lt;BR /&gt;
 &lt;BR /&gt;
'A character operand was found in the %EVAL function or %IF condition when a numeric operand is required.'&lt;BR /&gt;
 &lt;BR /&gt;
What am I doing wrong? I realize that %EVAL only works with integer values and can return this message when asked to do floating-point calculations, but I thought that %sysevalf could handle this kind of calculation. Any help would be greatly appreciated.</description>
    <pubDate>Wed, 25 Jun 2008 14:13:57 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-06-25T14:13:57Z</dc:date>
    <item>
      <title>evaluating logarithm using %sysevalf</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27728#M5123</link>
      <description>I'm writing a SAS macro which includes a proc sql. Within the proc sql, I need to take a logarithm. I tried doing so using:&lt;BR /&gt;
 &lt;BR /&gt;
%let DDenom=%sysevalf(log(&amp;amp;ProbBad/&amp;amp;ProbGood));&lt;BR /&gt;
 &lt;BR /&gt;
and receive the following error when the macro runs: &lt;BR /&gt;
 &lt;BR /&gt;
'A character operand was found in the %EVAL function or %IF condition when a numeric operand is required.'&lt;BR /&gt;
 &lt;BR /&gt;
What am I doing wrong? I realize that %EVAL only works with integer values and can return this message when asked to do floating-point calculations, but I thought that %sysevalf could handle this kind of calculation. Any help would be greatly appreciated.</description>
      <pubDate>Wed, 25 Jun 2008 14:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27728#M5123</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-25T14:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: evaluating logarithm using %sysevalf</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27729#M5124</link>
      <description>The error is coming from the fact that you are trying to use a data step fuction in the macro facility without also using %SysFunc.  %SysEvalF sees that and cant make out what to do with it and throws the error you are seeing.  &lt;BR /&gt;
&lt;BR /&gt;
Try this instead.&lt;BR /&gt;
&lt;BR /&gt;
%Let A = 10  ;&lt;BR /&gt;
%Let B = 100 ;&lt;BR /&gt;
%Let C = %SysEvalF( %SysFunc( Log( &amp;amp;A / &amp;amp;B ) ) ) ;&lt;BR /&gt;
&lt;BR /&gt;
%Put _User_ ;</description>
      <pubDate>Wed, 25 Jun 2008 21:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27729#M5124</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-25T21:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: evaluating logarithm using %sysevalf</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27730#M5125</link>
      <description>I don't even think that BOTH %sysfunc and %sysevalf are needed : %sysfunc will "host" the computations anyhow.&lt;BR /&gt;
[pre]&lt;BR /&gt;
%LET a = 10 ;&lt;BR /&gt;
%LET b = 100 ;&lt;BR /&gt;
%LET log_a_b = %SYSFUNC(LOG(&amp;amp;a/&amp;amp;b)) ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
PS : you can even use the %SYSFUNC to round the result, just add a format as a second argument :&lt;BR /&gt;
[pre]&lt;BR /&gt;
%LET log_a_b = %SYSFUNC(LOG(&amp;amp;a/&amp;amp;b), 10.3) ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Regards.&lt;BR /&gt;
Olivier</description>
      <pubDate>Thu, 26 Jun 2008 09:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27730#M5125</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2008-06-26T09:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: evaluating logarithm using %sysevalf</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27731#M5126</link>
      <description>Thanks for your responses. %Sysfunc did the trick. I appreciate the help.</description>
      <pubDate>Thu, 26 Jun 2008 15:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluating-logarithm-using-sysevalf/m-p/27731#M5126</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-26T15:08:46Z</dc:date>
    </item>
  </channel>
</rss>

