<?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: simple if function doesn't work in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769771#M39573</link>
    <description>Have used to only read the log line that has errors. Glad to learn this new skill to read the log deeply.</description>
    <pubDate>Thu, 23 Sep 2021 02:17:08 GMT</pubDate>
    <dc:creator>yliu1234</dc:creator>
    <dc:date>2021-09-23T02:17:08Z</dc:date>
    <item>
      <title>simple if function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769714#M39566</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data;
Business_Type = 'COMPANY';
party_type = 'individual';
if (Business_Type &amp;lt;&amp;gt; 'INDIVIDUAL' and party_type = 'individual')
then do;
party_type_FLAG="put "||COMPRESS(lowcase(Business_Type))||" as "||COMPRESS(party_type);
end;
else do; party_type_FLAG = 'match'; end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I expect this result, since the IF should return TRUE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="344"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="99"&gt;Business_Type&lt;/TD&gt;
&lt;TD width="74"&gt;party_type&lt;/TD&gt;
&lt;TD width="171"&gt;party_type_FLAG&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;COMPANY&lt;/TD&gt;
&lt;TD&gt;individual&lt;/TD&gt;
&lt;TD&gt;put company as individual&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However I got this result:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yliu1234_0-1632343523260.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63951i2296A6791E6CE306/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yliu1234_0-1632343523260.png" alt="yliu1234_0-1632343523260.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 20:46:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769714#M39566</guid>
      <dc:creator>yliu1234</dc:creator>
      <dc:date>2021-09-22T20:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: simple if function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769718#M39567</link>
      <description>&lt;P&gt;Your syntax &amp;lt;&amp;gt; deceived you-&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;333 if (Business_Type &amp;lt;&amp;gt; 'INDIVIDUAL' and party_type = 'individual')&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
329
330  data;
331  Business_Type = 'COMPANY';
332  party_type = 'individual';
333  if (Business_Type &amp;lt;&amp;gt; 'INDIVIDUAL' and party_type = 'individual')
NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".
334  then do;
335  party_type_FLAG="put "||COMPRESS(lowcase(Business_Type))||" as "||COMPRESS(party_type);
336  end;
337  else do; party_type_FLAG = 'match'; end;
338  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      333:19
NOTE: Invalid numeric data, 'INDIVIDUAL' , at line 333 column 19.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be printed.
Business_Type=COMPANY party_type=individual party_type_FLAG=match _ERROR_=1 _N_=1
NOTE: The data set WORK.DATA3 has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;P&gt;if (Business_Type &lt;STRONG&gt;ne&lt;/STRONG&gt; 'INDIVIDUAL' and party_type = 'individual')&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 21:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769718#M39567</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-09-22T21:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: simple if function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769719#M39568</link>
      <description>&lt;P&gt;What are you imagining the &amp;lt;&amp;gt; comparison means?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In an IF statement in a DATA step, it's the MAX operator.&amp;nbsp; In PROC SQL, it's "not equal".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just spell out the comparison that you want.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 21:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769719#M39568</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-09-22T21:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: simple if function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769720#M39569</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 2&lt;/A&gt;: read the log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A problem is clearly indicated. Fix that and your code will probably work.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 21:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769720#M39569</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-22T21:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: simple if function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769769#M39571</link>
      <description>Thank you. I wrote a lot of proc sql, too confidence of these operator, never think about it.</description>
      <pubDate>Thu, 23 Sep 2021 02:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769769#M39571</guid>
      <dc:creator>yliu1234</dc:creator>
      <dc:date>2021-09-23T02:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: simple if function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769770#M39572</link>
      <description>Thanks!</description>
      <pubDate>Thu, 23 Sep 2021 02:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769770#M39572</guid>
      <dc:creator>yliu1234</dc:creator>
      <dc:date>2021-09-23T02:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: simple if function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769771#M39573</link>
      <description>Have used to only read the log line that has errors. Glad to learn this new skill to read the log deeply.</description>
      <pubDate>Thu, 23 Sep 2021 02:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/simple-if-function-doesn-t-work/m-p/769771#M39573</guid>
      <dc:creator>yliu1234</dc:creator>
      <dc:date>2021-09-23T02:17:08Z</dc:date>
    </item>
  </channel>
</rss>

