<?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: How is it stored this boolean expression? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93814#M19781</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, all the math will get performed.&amp;nbsp; You might get some savings by switching as you suggest:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if k=1 then ...;&lt;/P&gt;&lt;P&gt;else if k=2 then ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, this code works faster if k=1 most of the time.&amp;nbsp; If k=2 most of the time, you could switch and test for k=2 first.&amp;nbsp; But truthfully, the savings will be tiny, perhaps not even measurable.&amp;nbsp; If you are interested in efficiency, you might post more of your code and get suggestions about how to speed it up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Apr 2013 18:58:37 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2013-04-01T18:58:37Z</dc:date>
    <item>
      <title>How is it stored this boolean expression?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93811#M19778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which way is faster?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose I want to write the expression (k=1)*e+(k=2)*f and suppose that e,f need to be calculated. Does SAS calculate e,f , then (k=1)*e+(k=2)*f&amp;nbsp; or does it evaluate first the boolean expressions (k=1) and (k=2) and then the corresponding e if k=1 is true or f if k=2 is true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If SAS calculates both e and f&amp;nbsp; then it is more efficient to do a conditional&lt;/P&gt;&lt;P&gt;if k=1 then do e;&lt;/P&gt;&lt;P&gt;else do f;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 05:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93811#M19778</guid>
      <dc:creator>Bogdan</dc:creator>
      <dc:date>2013-04-01T05:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: How is it stored this boolean expression?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93812#M19779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't you write some code to test your assumption?&amp;nbsp; Do each a million times and observe the time difference.&amp;nbsp; You will need options FULLSTIMER.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 10:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93812#M19779</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-04-01T10:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: How is it stored this boolean expression?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93813#M19780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here are references to help you understand the order of evaluation of an expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Logic: and, not, or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1bhfu7h99wzgwn1md27dqxx4b5y.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1bhfu7h99wzgwn1md27dqxx4b5y.htm"&gt;SAS(R) 9.3 Language Reference: Concepts, Second Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arithmetic:&lt;/P&gt;&lt;P&gt;SAS Operators in Expressions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#p00iah2thp63bmn1lt20esag14lh.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#p00iah2thp63bmn1lt20esag14lh.htm"&gt;SAS(R) 9.3 Language Reference: Concepts, Second Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; knot logically lazy maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 17:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93813#M19780</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-04-01T17:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: How is it stored this boolean expression?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93814#M19781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, all the math will get performed.&amp;nbsp; You might get some savings by switching as you suggest:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if k=1 then ...;&lt;/P&gt;&lt;P&gt;else if k=2 then ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, this code works faster if k=1 most of the time.&amp;nbsp; If k=2 most of the time, you could switch and test for k=2 first.&amp;nbsp; But truthfully, the savings will be tiny, perhaps not even measurable.&amp;nbsp; If you are interested in efficiency, you might post more of your code and get suggestions about how to speed it up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 18:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-is-it-stored-this-boolean-expression/m-p/93814#M19781</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-04-01T18:58:37Z</dc:date>
    </item>
  </channel>
</rss>

