<?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 Comparison between numbers in macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparison-between-numbers-in-macro/m-p/714069#M220392</link>
    <description>&lt;P&gt;Here's something interesting:&lt;/P&gt;
&lt;PRE&gt;%macro test(a);
	
	%if &amp;amp;a. &amp;gt;= 0 %then %put LARGER;
	%else %put SMALLER;

%mend;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;%test(.75);&lt;BR /&gt;MLOGIC(TEST): Beginning execution.&lt;BR /&gt;MLOGIC(TEST): Parameter A has value .75&lt;BR /&gt;SYMBOLGEN: Macro variable A resolves to .75&lt;BR /&gt;MLOGIC(TEST): %IF condition &amp;amp;a. &amp;gt;= 0 is FALSE&lt;BR /&gt;MLOGIC(TEST): %PUT SMALLER&lt;BR /&gt;SMALLER&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%test(0.75);&lt;BR /&gt;MLOGIC(TEST): Beginning execution.&lt;BR /&gt;MLOGIC(TEST): Parameter A has value 0.75&lt;BR /&gt;SYMBOLGEN: Macro variable A resolves to 0.75&lt;BR /&gt;MLOGIC(TEST): %IF condition &amp;amp;a. &amp;gt;= 0 is TRUE&lt;BR /&gt;MLOGIC(TEST): %PUT LARGER&lt;BR /&gt;LARGER&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can this happen in a software that is supposedly world leader in statistics and data analysis, and whose license costs thousands of dollars? HOW?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jan 2021 20:56:22 GMT</pubDate>
    <dc:creator>gabonzo</dc:creator>
    <dc:date>2021-01-25T20:56:22Z</dc:date>
    <item>
      <title>Comparison between numbers in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-between-numbers-in-macro/m-p/714069#M220392</link>
      <description>&lt;P&gt;Here's something interesting:&lt;/P&gt;
&lt;PRE&gt;%macro test(a);
	
	%if &amp;amp;a. &amp;gt;= 0 %then %put LARGER;
	%else %put SMALLER;

%mend;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;%test(.75);&lt;BR /&gt;MLOGIC(TEST): Beginning execution.&lt;BR /&gt;MLOGIC(TEST): Parameter A has value .75&lt;BR /&gt;SYMBOLGEN: Macro variable A resolves to .75&lt;BR /&gt;MLOGIC(TEST): %IF condition &amp;amp;a. &amp;gt;= 0 is FALSE&lt;BR /&gt;MLOGIC(TEST): %PUT SMALLER&lt;BR /&gt;SMALLER&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%test(0.75);&lt;BR /&gt;MLOGIC(TEST): Beginning execution.&lt;BR /&gt;MLOGIC(TEST): Parameter A has value 0.75&lt;BR /&gt;SYMBOLGEN: Macro variable A resolves to 0.75&lt;BR /&gt;MLOGIC(TEST): %IF condition &amp;amp;a. &amp;gt;= 0 is TRUE&lt;BR /&gt;MLOGIC(TEST): %PUT LARGER&lt;BR /&gt;LARGER&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can this happen in a software that is supposedly world leader in statistics and data analysis, and whose license costs thousands of dollars? HOW?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 20:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-between-numbers-in-macro/m-p/714069#M220392</guid>
      <dc:creator>gabonzo</dc:creator>
      <dc:date>2021-01-25T20:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison between numbers in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-between-numbers-in-macro/m-p/714080#M220396</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255651"&gt;@gabonzo&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since SAS software &lt;EM&gt;does&lt;/EM&gt; have all these positive attributes, you can be (almost) sure that this behavior of the SAS macro language is &lt;EM&gt;not&lt;/EM&gt; a bug, but that it is intended &lt;EM&gt;and&lt;/EM&gt; well documented. Here:&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=p17i177l3z4kzgn11m7pl8833ch7.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;How the Macro Processor Evaluates Arithmetic Expressions&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=p18bcfyqilvhc3n12stuo8eafd46.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;How the Macro Processor Evaluates Logical Expressions&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, if you want to feed non-integers to a macro like this, use the %SYSEVALF function in the %IF condition:&lt;/P&gt;
&lt;PRE&gt;%if &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;%sysevalf(&lt;/FONT&gt;&lt;/STRONG&gt;&amp;amp;a. &amp;gt;= 0&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt; %then ...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 21:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-between-numbers-in-macro/m-p/714080#M220396</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-01-25T21:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison between numbers in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-between-numbers-in-macro/m-p/714081#M220397</link>
      <description>Great! Maybe they should spend less money in documentation and more in useful stuff, like, I don't know, native functions?</description>
      <pubDate>Mon, 25 Jan 2021 21:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-between-numbers-in-macro/m-p/714081#M220397</guid>
      <dc:creator>gabonzo</dc:creator>
      <dc:date>2021-01-25T21:21:22Z</dc:date>
    </item>
  </channel>
</rss>

