<?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 doesn't SAS support short circuit operator? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722068#M223858</link>
    <description>&lt;P&gt;Interesting, just found &lt;A href="https://blogs.sas.com/content/iml/2019/08/14/short-circuit-evaluation-and-logical-ligatures-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2019/08/14/short-circuit-evaluation-and-logical-ligatures-in-sas.html&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;But your code &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270406"&gt;@whymath&lt;/a&gt; clearly shows that "or" is not a short circuit operator.&lt;/P&gt;
&lt;P&gt;Maybe &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; can enlighten us.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Feb 2021 08:06:52 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-02-26T08:06:52Z</dc:date>
    <item>
      <title>Why doesn't SAS support short circuit operator?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722065#M223856</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Run the code in SAS&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  if 1 or sum(.) then put 'Hi!';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It reports missing value was generated which shows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1.&amp;nbsp;&lt;CODE class=" language-sas"&gt;sum(.)&lt;/CODE&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;is evaluated;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. 'or' is not a short circuit operator.&lt;BR /&gt;I remeber SAS is wirten by C language and short circuit operator is supported in C. Why doesn't SAS support short circuit operation?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 07:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722065#M223856</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2021-02-26T07:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why doesn't SAS support short circuit operator?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722068#M223858</link>
      <description>&lt;P&gt;Interesting, just found &lt;A href="https://blogs.sas.com/content/iml/2019/08/14/short-circuit-evaluation-and-logical-ligatures-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2019/08/14/short-circuit-evaluation-and-logical-ligatures-in-sas.html&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;But your code &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270406"&gt;@whymath&lt;/a&gt; clearly shows that "or" is not a short circuit operator.&lt;/P&gt;
&lt;P&gt;Maybe &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; can enlighten us.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 08:06:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722068#M223858</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-02-26T08:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why doesn't SAS support short circuit operator?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722119#M223872</link>
      <description>&lt;P&gt;No, I don't know why some expressions short circuit and others do not. As I say in my blog post, "the SAS documentation does not discuss the conditions for which a logical expression does or does not short circuit." My experience is that simple expressions that compare a variable will probably short circuit. More complicated expressions that involve function calls might or might not short circuit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The safest choice for defensive programming is to use nested IF statements for situations in which&amp;nbsp;the second expression should not be evaluated unless the first succeeds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 12:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722119#M223872</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-02-26T12:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why doesn't SAS support short circuit operator?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722171#M223887</link>
      <description>&lt;P&gt;I'm not sure that the Sum is actually evaluated to use with the IF.&lt;/P&gt;
&lt;P&gt;I think that may be a part of the general SAS programming of some functions to make sure that you are using the data you think you have in an appropriate manner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider, why in general would you attempt to SUM values? You expect something as a result. So when you provide a variable, or list that is all missing values to the function then log tells you that you had some records with missing values. That may well tell you that your program logic is incorrect for your given data, your data is not as you expect, or possibly provided the wrong arguments to the function.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 15:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-doesn-t-SAS-support-short-circuit-operator/m-p/722171#M223887</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-26T15:18:04Z</dc:date>
    </item>
  </channel>
</rss>

