<?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 Not equals in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Not-equals/m-p/93240#M19657</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A colleague of mine tried to do something relatively trivial, wanted to look for all values which were not null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;He used &amp;lt;&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I generally never use that, I would use ^= for numbers and ne for string comparisons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just for fun, I ran the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data not_equal;&lt;BR /&gt;17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = 0; b = .;&lt;BR /&gt;18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ne1 = ifc(a ^= b, 'Good', 'Bad ');&lt;BR /&gt;20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ne2 = ifc(a ne b, 'Good', 'Bad ');&lt;BR /&gt;21&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ne3 = ifc(a &amp;lt;&amp;gt; b, 'Good', 'Bad ');&lt;BR /&gt;NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".&lt;BR /&gt;22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.NOT_EQUAL has 1 observations and 5 variables.&lt;/P&gt;&lt;P&gt;^^&lt;/P&gt;&lt;P&gt;The output was as follows:&lt;/P&gt;&lt;P&gt;a b ne1 ne2 ne3&lt;/P&gt;&lt;P&gt;0&amp;nbsp; Good Good Bad&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the following:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;^^&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure how to explain why they shouldn't be using the &amp;lt;&amp;gt; syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be correct to say that the &amp;lt;&amp;gt; notation means MAX ?&amp;nbsp; I don't think that's quite right when I don't use brackets around a&amp;lt;&amp;gt;b.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Dec 2012 23:46:20 GMT</pubDate>
    <dc:creator>JohnT</dc:creator>
    <dc:date>2012-12-06T23:46:20Z</dc:date>
    <item>
      <title>Not equals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-equals/m-p/93240#M19657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A colleague of mine tried to do something relatively trivial, wanted to look for all values which were not null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;He used &amp;lt;&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I generally never use that, I would use ^= for numbers and ne for string comparisons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just for fun, I ran the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data not_equal;&lt;BR /&gt;17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = 0; b = .;&lt;BR /&gt;18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ne1 = ifc(a ^= b, 'Good', 'Bad ');&lt;BR /&gt;20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ne2 = ifc(a ne b, 'Good', 'Bad ');&lt;BR /&gt;21&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ne3 = ifc(a &amp;lt;&amp;gt; b, 'Good', 'Bad ');&lt;BR /&gt;NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".&lt;BR /&gt;22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.NOT_EQUAL has 1 observations and 5 variables.&lt;/P&gt;&lt;P&gt;^^&lt;/P&gt;&lt;P&gt;The output was as follows:&lt;/P&gt;&lt;P&gt;a b ne1 ne2 ne3&lt;/P&gt;&lt;P&gt;0&amp;nbsp; Good Good Bad&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the following:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;^^&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure how to explain why they shouldn't be using the &amp;lt;&amp;gt; syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be correct to say that the &amp;lt;&amp;gt; notation means MAX ?&amp;nbsp; I don't think that's quite right when I don't use brackets around a&amp;lt;&amp;gt;b.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 23:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-equals/m-p/93240#M19657</guid>
      <dc:creator>JohnT</dc:creator>
      <dc:date>2012-12-06T23:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Not equals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-equals/m-p/93241#M19658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not that you shouldn't use the MAX operator ... it's just that the results you get are different.&amp;nbsp; After all, just look at the results you got, where NE3 was Bad, but the others were Good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first two comparisons (calculating NE1 and NE2) return a 0 (when the comparison is false) or a 1 (when the comparison is true).&amp;nbsp; SAS interprets 0 as false, and 1 as true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The third comparison ... well it isn't a comparison at all.&amp;nbsp; MAX returns the larger number, in this case 0.&amp;nbsp; As before, 0 is false.&amp;nbsp; Perhaps your colleague would be persuaded if you were to run the exact same program but with one small change.&amp;nbsp; Use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now NE3 will switch from Bad to Good.&amp;nbsp; Technically, you could even use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a = -5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result will still be Good.&amp;nbsp; SAS interprets more than 0 and 1 ... it interprets 0 and missing as false, and anything else as true.&amp;nbsp; So you could also play with a combination like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a = .A;&lt;/P&gt;&lt;P&gt;b = .;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are times when MAX is the right tool for the job.&amp;nbsp; This isn't one of them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 23:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-equals/m-p/93241#M19658</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-12-06T23:58:21Z</dc:date>
    </item>
  </channel>
</rss>

