<?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 OR operator doesn't works properly inside IF THEN statements? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727643#M226363</link>
    <description>&lt;P&gt;&lt;SPAN&gt;If fix below, you can get correct output.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if (ID ne IDN1 &lt;STRONG&gt;AND&lt;/STRONG&gt; ID ne IDN2) then output;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Mar 2021 05:19:32 GMT</pubDate>
    <dc:creator>japelin</dc:creator>
    <dc:date>2021-03-19T05:19:32Z</dc:date>
    <item>
      <title>Why OR operator doesn't works properly inside IF THEN statements?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727636#M226359</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;In below example, I would like to get missing ID values which is not matched with my assigned value in macro variable. I know I can perform this task as I did in my Query2 to get correct output, but I don't understand about what's wrong in my Query1.&lt;/P&gt;&lt;P&gt;Can someone explain me why query1 in my below piece of code is not giving desired output?&amp;nbsp;&lt;/P&gt;&lt;P&gt;/****************************************************************************************/&lt;/P&gt;&lt;P&gt;data ID_Table;&lt;BR /&gt;input ID $10.;&lt;BR /&gt;cards;&lt;BR /&gt;1000000001&lt;BR /&gt;1000000002&lt;BR /&gt;1000000003&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;%let IDN1 = 1000000001;&lt;BR /&gt;%let IDN2 = 1000000002;&lt;/P&gt;&lt;P&gt;/*Query1*/&lt;BR /&gt;data Missing_ID_Wrong_Output;&lt;BR /&gt;set ID_Table;&lt;BR /&gt;IDN1=input(&amp;amp;IDN1.,best12.);&lt;BR /&gt;IDN2=input(&amp;amp;IDN2.,best12.);&lt;BR /&gt;if (ID ne IDN1 OR ID ne IDN2) then output;&lt;BR /&gt;keep ID;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=Missing_ID_Wrong_Output noobs;run;&lt;BR /&gt;/*&lt;BR /&gt;ID&lt;BR /&gt;1000000001&lt;BR /&gt;1000000002&lt;BR /&gt;1000000003&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;/*Query2*/&lt;BR /&gt;data Missing_ID_Correct_Output;&lt;BR /&gt;set ID_Table;&lt;BR /&gt;if ID not in (&amp;amp;IDN1., &amp;amp;IDN2.) then output;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=Missing_ID_Correct_Output noobs;run;&lt;BR /&gt;/*&lt;BR /&gt;ID&lt;BR /&gt;1000000003&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;/****************************************************************************************/&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 04:41:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727636#M226359</guid>
      <dc:creator>tpchaudhary</dc:creator>
      <dc:date>2021-03-19T04:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why OR operator doesn't works properly inside IF THEN statements?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727643#M226363</link>
      <description>&lt;P&gt;&lt;SPAN&gt;If fix below, you can get correct output.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if (ID ne IDN1 &lt;STRONG&gt;AND&lt;/STRONG&gt; ID ne IDN2) then output;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 05:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727643#M226363</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-03-19T05:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why OR operator doesn't works properly inside IF THEN statements?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727689#M226385</link>
      <description>As was suggested, you need to change OR to AND.  however, there is also another issue.  You have ignored messages in the log about numeric to character conversion when using the INPUT function.  The best solution would eliminate the INPUT function entirely.&lt;BR /&gt;&lt;BR /&gt;if ID ne &amp;amp;IDN1 and ID ne &amp;amp;IDN2 then output;</description>
      <pubDate>Fri, 19 Mar 2021 08:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727689#M226385</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-03-19T08:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why OR operator doesn't works properly inside IF THEN statements?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727749#M226411</link>
      <description>&lt;P&gt;Thanks folks for quick respond with perfect solution!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 13:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-OR-operator-doesn-t-works-properly-inside-IF-THEN-statements/m-p/727749#M226411</guid>
      <dc:creator>tpchaudhary</dc:creator>
      <dc:date>2021-03-19T13:23:11Z</dc:date>
    </item>
  </channel>
</rss>

