<?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 Re: Why does this work ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182388#M34739</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because 0 not 0 is equal to 1.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;17&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; NOTE: &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; not &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;NOTE: &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Feb 2014 16:49:19 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2014-02-21T16:49:19Z</dc:date>
    <item>
      <title>Why does this work ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182387#M34738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;** no "and" in condition -seems to be assumed **;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; &lt;STRONG&gt;&lt;EM&gt;check&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%if&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;(fileexist(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;"&amp;amp;PV1."&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;(fileexist(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;"&amp;amp;PV2."&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%then&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; "hello";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; outside;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;%let pv1=&amp;lt;path/filename1&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background: white; font-family: 'Courier New';"&gt;%let pv2=&amp;lt;path/filename2&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;%check;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 16:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182387#M34738</guid>
      <dc:creator>DougStad</dc:creator>
      <dc:date>2014-02-21T16:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this work ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182388#M34739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because 0 not 0 is equal to 1.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;17&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; NOTE: &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; not &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;NOTE: &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 16:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182388#M34739</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-02-21T16:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this work ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182389#M34740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DN: Can you explain that for me/us?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I know that is the result that SAS gives, but I don't know why.&amp;nbsp; I ran the following and got the following result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE1: %eval(0 not 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE2: %eval(0 not 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE3: %eval(1 not 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE4: %eval(1 not 0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;results in:&lt;/P&gt;&lt;P&gt;NOTE1: 1&lt;/P&gt;&lt;P&gt;NOTE2: 0&lt;/P&gt;&lt;P&gt;NOTE3: 0&lt;/P&gt;&lt;P&gt;NOTE4: 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see the answers, but have no idea what is being compared.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 17:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182389#M34740</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-02-21T17:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this work ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182390#M34741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know that I can explain it, at least not logically. :smileyshocked:&amp;nbsp; I refer you to &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/67227/HTML/default/viewer.htm#p00iah2thp63bmn1lt20esag14lh.htm"&gt;SAS Operators in Expressions&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 19:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182390#M34741</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-02-21T19:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this work ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182391#M34742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I vote for an error in the %eval function.&amp;nbsp; I did read that section in the documentation and realize that not is supposed to be an operator, but the following won't work in a data step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x1=0 not 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x2=0 not 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x3=1 not 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x4=1 not 0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conversely, the following will run in a SAS macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro check;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %sysfunc(fileexist("&amp;amp;PV1."))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not %sysfunc(fileexist("&amp;amp;PV2."))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %then %do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put "hello";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put outside;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE1: %eval(0 not 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE2: %eval(0 not 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE3: %eval(-0 not 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE4: %eval(-0 not 0);&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let pv1=&amp;lt;path/filename1&amp;gt;;&lt;/P&gt;&lt;P&gt;%let pv2=&amp;lt;path/filename2&amp;gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%check&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and will produce:&lt;/P&gt;&lt;P&gt;"hello"&lt;/P&gt;&lt;P&gt;outside&lt;/P&gt;&lt;P&gt;NOTE1: 1&lt;/P&gt;&lt;P&gt;NOTE2: 0&lt;/P&gt;&lt;P&gt;NOTE3: 0&lt;/P&gt;&lt;P&gt;NOTE4: 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;methinks that %eval() is only looking at the not 0 and not 1 parts and ignoring whatever comes before the 'not'.&amp;nbsp; As a test of that hypothesis, the following works and provides the same result as the previous macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro check;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %sysfunc(fileexist("&amp;amp;PV1."))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not %sysfunc(fileexist("&amp;amp;PV2."))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %then %do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put "hello";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put outside;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE1: %eval("cc" not 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE2: %eval("xx" not 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE3: %eval("yy" not 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put NOTE4: %eval("zz" not 0);&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let pv1=&amp;lt;path/filename1&amp;gt;;&lt;/P&gt;&lt;P&gt;%let pv2=&amp;lt;path/filename2&amp;gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%check&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 19:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182391#M34742</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-02-21T19:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this work ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182392#M34743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As an aide to clarity&lt;/P&gt;&lt;P&gt;NOT&lt;/P&gt;&lt;P&gt;Is not the same operator as&lt;/P&gt;&lt;P&gt;NE&lt;/P&gt;&lt;P&gt;and the effect is quite different&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Feb 2014 16:46:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182392#M34743</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-02-22T16:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this work ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182393#M34744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case I didn't make myself clear in my last post, I think the reason it works is that %eval has an unaddressed fault that is allowing erroneous code to run without returning an error.&amp;nbsp; As is, given a use like &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%eval("cc" not 0);&lt;/SPAN&gt; the only thing being returned is the answer to "not 0" which would be 1. The first value (in this case "cc") isn't even being considered. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Feb 2014 17:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-does-this-work/m-p/182393#M34744</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-02-22T17:47:41Z</dc:date>
    </item>
  </channel>
</rss>

