<?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 Order of operation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Order-of-operation/m-p/619335#M181805</link>
    <description>&lt;P&gt;I'm writing my code wrong or I'm misunderstanding the order of operations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My&amp;nbsp;Comp_Stnd_DVLD_Rate is coming back as .02 but it should be returning .04 (highlighted in red below).&amp;nbsp; SAS runs up against the first if/do and assigns the .02 but why is it not being reset to .04 when it runs up against a subsequent if/do?&amp;nbsp; Do I need to break it out into multiple statements and take a max?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;COMB_Prem_current = $449,000&lt;/P&gt;&lt;P&gt;COMB_LOC_Current = 84&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data brokers_tot_stnd_new2;&lt;BR /&gt;set brokers_tot_stnd_new1;&lt;BR /&gt;if (COMB_Prem_current &amp;lt;= 74999.99 and COMB_LOC_Current &amp;lt;= 9) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 0;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 0;&lt;BR /&gt;end;&lt;BR /&gt;else if ((75000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 249999.99) and (10 &amp;lt;= COMB_LOC_Current &amp;lt;= 19)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.01;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((&lt;FONT color="#FF0000"&gt;250000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 749999.99&lt;/FONT&gt;) or (20 &amp;lt;= COMB_LOC_Current &amp;lt;= 29)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.02;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((750000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 1499999.99) or (30 &amp;lt;= COMB_LOC_Current &amp;lt;= 39)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.025;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((1500000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 1999999.99) or (40 &amp;lt;= COMB_LOC_Current &amp;lt;= 49)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.03;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((COMB_Prem_current &amp;gt;= 3000000.00) or (&lt;FONT color="#FF0000"&gt;COMB_LOC_Current &amp;gt;= 50&lt;/FONT&gt;)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.04;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2020 21:55:56 GMT</pubDate>
    <dc:creator>LuAnnS</dc:creator>
    <dc:date>2020-01-22T21:55:56Z</dc:date>
    <item>
      <title>Order of operation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-operation/m-p/619335#M181805</link>
      <description>&lt;P&gt;I'm writing my code wrong or I'm misunderstanding the order of operations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My&amp;nbsp;Comp_Stnd_DVLD_Rate is coming back as .02 but it should be returning .04 (highlighted in red below).&amp;nbsp; SAS runs up against the first if/do and assigns the .02 but why is it not being reset to .04 when it runs up against a subsequent if/do?&amp;nbsp; Do I need to break it out into multiple statements and take a max?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;COMB_Prem_current = $449,000&lt;/P&gt;&lt;P&gt;COMB_LOC_Current = 84&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data brokers_tot_stnd_new2;&lt;BR /&gt;set brokers_tot_stnd_new1;&lt;BR /&gt;if (COMB_Prem_current &amp;lt;= 74999.99 and COMB_LOC_Current &amp;lt;= 9) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 0;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 0;&lt;BR /&gt;end;&lt;BR /&gt;else if ((75000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 249999.99) and (10 &amp;lt;= COMB_LOC_Current &amp;lt;= 19)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.01;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((&lt;FONT color="#FF0000"&gt;250000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 749999.99&lt;/FONT&gt;) or (20 &amp;lt;= COMB_LOC_Current &amp;lt;= 29)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.02;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((750000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 1499999.99) or (30 &amp;lt;= COMB_LOC_Current &amp;lt;= 39)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.025;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((1500000.00 &amp;lt;= COMB_Prem_current &amp;lt;= 1999999.99) or (40 &amp;lt;= COMB_LOC_Current &amp;lt;= 49)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.03;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;else if ((COMB_Prem_current &amp;gt;= 3000000.00) or (&lt;FONT color="#FF0000"&gt;COMB_LOC_Current &amp;gt;= 50&lt;/FONT&gt;)) then&lt;BR /&gt;do;&lt;BR /&gt;Comp_Stnd_DVLD_Rate = 0.04;&lt;BR /&gt;Comp_Stnd_DENASO_Rate = 1.20;&lt;BR /&gt;Comp_Stnd_VISASO_Rate = 1;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 21:55:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-operation/m-p/619335#M181805</guid>
      <dc:creator>LuAnnS</dc:creator>
      <dc:date>2020-01-22T21:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Order of operation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-operation/m-p/619337#M181807</link>
      <description>&lt;P&gt;How could it. You structured you conditional logic as one long IF/ELSE IF/ELSE IF ... series. Once it meets the condition of any of the IF conditions is will not then also go down the ELSE clause.&lt;/P&gt;
&lt;P&gt;If you want the one that sets the value to 0.04 to override the test that results in&amp;nbsp; 0.02 then change the order.&lt;/P&gt;
&lt;P&gt;If you want each test to be evaluated independently then remove the ELSE keywords.&amp;nbsp; &amp;nbsp;But then again the last true condition will "win".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 22:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-operation/m-p/619337#M181807</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-22T22:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Order of operation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-operation/m-p/619338#M181808</link>
      <description>&lt;P&gt;I see what you're saying.&amp;nbsp; Thank you.&amp;nbsp; As soon as I took out the 'else', it worked.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 22:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-operation/m-p/619338#M181808</guid>
      <dc:creator>LuAnnS</dc:creator>
      <dc:date>2020-01-22T22:06:34Z</dc:date>
    </item>
  </channel>
</rss>

