<?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 Strange behaviour of %sysevalf with negative values of the macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/465934#M118860</link>
    <description>&lt;P&gt;Hi all, I have a question with respect to the %sysevalf. I use in a macro programm the %if-condition of the following form:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%if %sysevalf(&amp;amp;est)&amp;gt;0.4 %then %do;
....
%end;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works fine if &amp;amp;est has positive values, for example 0.312 or 1.214.But if &amp;amp;est is negative, for example -0.091, then I become the error:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;A character operand was found in the %EVAL function or %IF condition where a numeric operand is required.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I dont' understand why it could be important if the number in the macro variable is positive or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has somebody&amp;nbsp;seen this effect and has an explanation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Wed, 30 May 2018 08:00:08 GMT</pubDate>
    <dc:creator>DrBoogie</dc:creator>
    <dc:date>2018-05-30T08:00:08Z</dc:date>
    <item>
      <title>Strange behaviour of %sysevalf with negative values of the macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/465934#M118860</link>
      <description>&lt;P&gt;Hi all, I have a question with respect to the %sysevalf. I use in a macro programm the %if-condition of the following form:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%if %sysevalf(&amp;amp;est)&amp;gt;0.4 %then %do;
....
%end;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works fine if &amp;amp;est has positive values, for example 0.312 or 1.214.But if &amp;amp;est is negative, for example -0.091, then I become the error:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;A character operand was found in the %EVAL function or %IF condition where a numeric operand is required.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I dont' understand why it could be important if the number in the macro variable is positive or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has somebody&amp;nbsp;seen this effect and has an explanation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 08:00:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/465934#M118860</guid>
      <dc:creator>DrBoogie</dc:creator>
      <dc:date>2018-05-30T08:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour of %sysevalf with negative values of the macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/465940#M118862</link>
      <description>&lt;P&gt;Should that not read:&lt;/P&gt;
&lt;PRE&gt;%if %sysevalf(&amp;amp;est. &amp;gt; 0.4, boolean) %then %do;
....
%end;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, I highly advise avoiding doing data processing in macro - macro is after all just a text find/replace system and has virtually no concept of data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just o add, I think that as sysevalf does floating point calculations, when the var is de-referenced you see:&lt;/P&gt;
&lt;P&gt;%syevalf(-0.091)&lt;/P&gt;
&lt;P&gt;Which may look like like a calculation to the function, but incomplete.&amp;nbsp; Just guessing here though, based on the manual:&lt;/P&gt;
&lt;TABLE width="100%" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR valign="bottom"&gt;
&lt;TD&gt;&lt;HR /&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR valign="top"&gt;
&lt;TD&gt;
&lt;H2&gt;&lt;A name="a002560403" target="_blank"&gt;&lt;/A&gt;Syntax&lt;/H2&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;TABLE cellspacing="2" cellpadding="4"&gt;
&lt;TBODY&gt;
&lt;TR valign="top"&gt;
&lt;TD&gt;&lt;SPAN class="strong"&gt;%SYSEVALF&lt;/SPAN&gt;(&lt;SPAN class="emph"&gt;expression&lt;/SPAN&gt;&amp;lt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="emph"&gt;conversion-type&lt;/SPAN&gt;&amp;gt;)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;A name="a000739187" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A name="a002560404" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A name="a000739188" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;DL&gt;
&lt;DT&gt;&lt;SPAN class="strong"&gt;&lt;A name="a000739189" target="_blank"&gt;&lt;/A&gt;&lt;SPAN class="strongEmph"&gt;expression&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DT&gt;
&lt;DD&gt;
&lt;P&gt;&lt;A name="a000739190" target="_blank"&gt;&lt;/A&gt;is an arithmetic or logical expression to evaluate.&lt;/P&gt;
&lt;/DD&gt;
&lt;/DL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 09:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/465940#M118862</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-30T09:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour of %sysevalf with negative values of the macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/465973#M118874</link>
      <description>&lt;P&gt;Thank You, with %sysevalf(&amp;amp;est&amp;gt;0.4,boolean) it works. However I don't really understand, why&amp;nbsp;there is such&amp;nbsp;a difference between positive and negative values. But SAS is sometimes quite hard to unterstand, so it's OK. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 12:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/465973#M118874</guid>
      <dc:creator>DrBoogie</dc:creator>
      <dc:date>2018-05-30T12:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour of %sysevalf with negative values of the macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/466062#M118889</link>
      <description>&lt;P&gt;In your original code, %SYSEVALF computed the value before the &amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then ....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro language needed to compare the results.&amp;nbsp; It will automatically apply %EVAL when making the comparison&amp;nbsp; in the %IF statement (comparing the results of %SYSEVALF to 0.4).&amp;nbsp; However, %EVAL does not understand decimal points.&amp;nbsp; So macro language automatically makes a character comparison, comparing the first character of the %SYSEVALF result to the "0" within "0.4".&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 14:47:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Strange-behaviour-of-sysevalf-with-negative-values-of-the-macro/m-p/466062#M118889</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-30T14:47:34Z</dc:date>
    </item>
  </channel>
</rss>

