<?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: Expression evaluating to False but seems it should be True. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707224#M217127</link>
    <description>&lt;P&gt;Open a ticket with SAS support.&amp;nbsp; Send them this program:&lt;/P&gt;
&lt;PRE&gt;68   data test;
69     array a (2) a1 a2;
70     a1 = 1;
71     a2 = 0;
72     b = 1;
73     put 'ARRAY access  : ' @;
74     if b and (a(1) or (a(2) or 0)) then put 'TRUE'; else put 'FALSE';
75     put 'Direct access : ' @;
76     if b and (a1 or (a2 or 0)) then put 'TRUE'; else put 'FALSE';
77   run;

ARRAY access  : FALSE
Direct access : TRUE
NOTE: The data set WORK.TEST has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

&lt;/PRE&gt;</description>
    <pubDate>Sun, 20 Dec 2020 00:05:10 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-12-20T00:05:10Z</dc:date>
    <item>
      <title>Expression evaluating to False but seems it should be True.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707222#M217126</link>
      <description>&lt;P&gt;Any idea why HIT2 is not showing in the log from this code?:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data;&lt;BR /&gt;array a (2) a1 a2;&lt;BR /&gt;a1 = 1;&lt;BR /&gt;a2 = 0;&lt;BR /&gt;b = 1;&lt;BR /&gt;if b and (a(1) or a(2) or 0) then put 'HIT1';&lt;BR /&gt;if b and (a(1) or (a(2) or 0)) then put 'HIT2';&lt;BR /&gt;if b and (1 or (0 or 0)) then put 'HIT3';&lt;BR /&gt;put _all_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;HIT1&lt;BR /&gt;HIT3&lt;BR /&gt;a1=1 a2=0 b=1 _ERROR_=0 _N_=1&lt;/P&gt;</description>
      <pubDate>Sat, 19 Dec 2020 23:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707222#M217126</guid>
      <dc:creator>AndyGunn</dc:creator>
      <dc:date>2020-12-19T23:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Expression evaluating to False but seems it should be True.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707224#M217127</link>
      <description>&lt;P&gt;Open a ticket with SAS support.&amp;nbsp; Send them this program:&lt;/P&gt;
&lt;PRE&gt;68   data test;
69     array a (2) a1 a2;
70     a1 = 1;
71     a2 = 0;
72     b = 1;
73     put 'ARRAY access  : ' @;
74     if b and (a(1) or (a(2) or 0)) then put 'TRUE'; else put 'FALSE';
75     put 'Direct access : ' @;
76     if b and (a1 or (a2 or 0)) then put 'TRUE'; else put 'FALSE';
77   run;

ARRAY access  : FALSE
Direct access : TRUE
NOTE: The data set WORK.TEST has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Dec 2020 00:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707224#M217127</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-20T00:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Expression evaluating to False but seems it should be True.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707225#M217128</link>
      <description>&lt;P&gt;Open a track with Technical Support. This looks like a bug to me, and a rather serious one.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 00:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707225#M217128</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-20T00:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Expression evaluating to False but seems it should be True.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707227#M217129</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/361426"&gt;@AndyGunn&lt;/a&gt;&amp;nbsp; I very very vaguely recall reading this problem illustrated by either Guru's&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/21262"&gt;@hashman&lt;/a&gt; or &amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp; the 2 whom I closely follow suggesting to explicitly assign the value when it comes to array references- a(1)=1 , allternatively ^^a(1)/*&lt;EM&gt;for boolean&lt;/EM&gt;*/&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if b and (a(1)=1 or (a(2) or 0)) then put 'HIT2';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if b and (^^a(1) or (a(2) or 0)) then put 'HIT2';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However at 7:30pm with a couple of pints I can't remember which one that is.&amp;nbsp; Though my eyes are hazy, I am certain it's one of the above Guru's who once even suggested me to not to play with production codes like I used to otherwise. So -&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;141  data;
142  array a (2) a1 a2;
143  a1 = 1;
144  a2 = 0;
145  b = 1;
146  if b and (a(1) or a(2) or 0) then put 'HIT1';
147  if b and (a(1)=1 or (a(2) or 0)) then put 'HIT2';
148  if b and (1 or (0 or 0)) then put 'HIT3';
149  put _all_;
150  run;

HIT1
HIT2
HIT3
a1=1 a2=0 b=1 _ERROR_=0 _N_=1
NOTE: The data set WORK.DATA11 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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 01:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707227#M217129</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-12-20T01:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Expression evaluating to False but seems it should be True.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707233#M217131</link>
      <description>&lt;P&gt;Thanks much for the response(s).&amp;nbsp; I believe this is my first time ever posting here.&amp;nbsp; Rare to find problems like this - this one was painful.&amp;nbsp; But, I had hope wise people would help.&amp;nbsp; I will open a ticket with SAS.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 01:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707233#M217131</guid>
      <dc:creator>AndyGunn</dc:creator>
      <dc:date>2020-12-20T01:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Expression evaluating to False but seems it should be True.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707252#M217137</link>
      <description>Very Interesting. It seems ARRAY can't resolve itself and get it's value in CONDITION ,just a symbol refer to a variable.&lt;BR /&gt;&lt;BR /&gt;data test;&lt;BR /&gt;     array a{2} a1 a2 (1 0);&lt;BR /&gt;     a1 = 1;&lt;BR /&gt;    a2 = 0;&lt;BR /&gt;     b = 1;&lt;BR /&gt;     put 'ARRAY access  : ' @;&lt;BR /&gt;    if b and (a{1}=1 or (a{2}=1 or 0)) then put 'TRUE'; else put 'FALSE';&lt;BR /&gt;    put 'Direct access : ' @;&lt;BR /&gt;     if b and (a1 or (a2 or 0)) then put 'TRUE'; else put 'FALSE';&lt;BR /&gt;   run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ARRAY access  : TRUE&lt;BR /&gt;Direct access : TRUE&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 20 Dec 2020 11:46:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707252#M217137</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-12-20T11:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Expression evaluating to False but seems it should be True.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707590#M217270</link>
      <description>&lt;P&gt;Hello novinosrin, I did use the '=1' shown in&amp;nbsp; your example code to get my job working for now.&amp;nbsp; Was cleaner than things I was thinking of.&amp;nbsp; Have not heard back from SAS yet.&amp;nbsp; Track&amp;nbsp;7613246087.&amp;nbsp; Thanks,&amp;nbsp; Andy&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Expression-evaluating-to-False-but-seems-it-should-be-True/m-p/707590#M217270</guid>
      <dc:creator>AndyGunn</dc:creator>
      <dc:date>2020-12-21T23:08:41Z</dc:date>
    </item>
  </channel>
</rss>

