<?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: Case Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170649#M264224</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;This is because &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;arrears_multiplier &amp;gt;=1 includes 3 or greater also.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;when &lt;STRONG&gt;arrears_multiplier &amp;gt;=1&lt;/STRONG&gt; or arrears_lit_stage_code in ('J8','L3') then '1+ including possession'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;when arrears_multiplier &amp;gt;=3 or arrears_lit_stage_code in ('J8','L3') then '3+ including possession'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;when arrears_multiplier &amp;gt;=6 or arrears_lit_stage_code in ('J8','L3') then '6+ including possession'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Jan 2015 17:36:03 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2015-01-06T17:36:03Z</dc:date>
    <item>
      <title>Case Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170647#M264222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the oode below but the output isn't working as expected.&lt;/P&gt;&lt;P&gt;As you can see im looking to group the arrears_multiplier but byt having this case statement, all the accounts that are &amp;gt;=1 arrears fall into the 1+ including possession, how can I get the code to split it out like the following -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="335"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl70" height="17" width="139"&gt;Arrears&lt;/TD&gt;&lt;TD class="xl70" style="border-left: medium none;" width="196"&gt;Risk&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="17" style="border-top: medium none;"&gt;1+ inc possession&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; £&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 829,675,536.56 &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="17" style="border-top: medium none;"&gt;3+ inc possession&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; £&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 327,507,427.14 &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="17" style="border-top: medium none;"&gt;6+ inc possession&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; £&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 143,861,119.30 &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table work.summary1 as&lt;/P&gt;&lt;P&gt;select &lt;/P&gt;&lt;P&gt;month_date,&lt;/P&gt;&lt;P&gt;accnum,&lt;/P&gt;&lt;P&gt;balance_outstanding,&lt;/P&gt;&lt;P&gt;arrears_multiplier,&lt;/P&gt;&lt;P&gt;accnum,&lt;/P&gt;&lt;P&gt;case &lt;/P&gt;&lt;P&gt;when arrears_multiplier &amp;gt;=1 or arrears_lit_stage_code in ('J8','L3') then '1+ including possession'&lt;/P&gt;&lt;P&gt;when arrears_multiplier &amp;gt;=3 or arrears_lit_stage_code in ('J8','L3') then '3+ including possession'&lt;/P&gt;&lt;P&gt;when arrears_multiplier &amp;gt;=6 or arrears_lit_stage_code in ('J8','L3') then '6+ including possession'&lt;/P&gt;&lt;P&gt;else 'null' end as Arrears,&lt;/P&gt;&lt;P&gt;sum(case when arrears_multiplier &amp;gt;= 1 or arrears_lit_stage_code in ('J8','L3') then balance_outstanding else 0 end) as e1_1plus,&lt;/P&gt;&lt;P&gt;sum(case when arrears_multiplier &amp;gt;= 3 or arrears_lit_stage_code in ('J8','L3') then balance_outstanding else 0 end) as e2_3plus,&lt;/P&gt;&lt;P&gt;sum(case when arrears_multiplier &amp;gt;= 6 or arrears_lit_stage_code in ('J8','L3') then balance_outstanding else 0 end) as e3_6plus,&lt;/P&gt;&lt;P&gt;sum(case when arrears_lit_stage_code in ('J8','L3') then balance_outstanding else 0 end) as e4_possession,&lt;/P&gt;&lt;P&gt;sum(case when Current_default = 'Y' then balance_outstanding else 0 end) as e5_default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;from nov14&lt;/P&gt;&lt;P&gt;where &lt;/P&gt;&lt;P&gt;arrears_lit_stage_code not in ('L4','L5','L6') &lt;/P&gt;&lt;P&gt;group by month_date; &lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 17:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170647#M264222</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2015-01-06T17:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170648#M264223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The case statement stops execution as soon as as it finds a match. Since something that is &amp;gt;= 3 is also &amp;gt;= 1, the second condition is always met by the first. Reverse the order of eveluation in the case statement if you want to avoid this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 17:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170648#M264223</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-01-06T17:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170649#M264224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;This is because &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;arrears_multiplier &amp;gt;=1 includes 3 or greater also.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;when &lt;STRONG&gt;arrears_multiplier &amp;gt;=1&lt;/STRONG&gt; or arrears_lit_stage_code in ('J8','L3') then '1+ including possession'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;when arrears_multiplier &amp;gt;=3 or arrears_lit_stage_code in ('J8','L3') then '3+ including possession'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;when arrears_multiplier &amp;gt;=6 or arrears_lit_stage_code in ('J8','L3') then '6+ including possession'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 17:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170649#M264224</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2015-01-06T17:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170650#M264225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Should your OR be AND in your WHEN statements?&lt;/P&gt;&lt;P&gt;Anything that meets the second or third condition would meet the first condition and be already classified, so re-ordering them might help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;when arrears_multiplier &amp;gt;=1 or arrears_lit_stage_code in ('J8','L3') then '1+ including possession'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;when arrears_multiplier &amp;gt;=3 or arrears_lit_stage_code in ('J8','L3') then '3+ including possession'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;when arrears_multiplier &amp;gt;=6 or arrears_lit_stage_code in ('J8','L3') then '6+ including possession'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're calculating a lot more variables in your code than shown in your desired output so hard to say what you want. Perhaps sample data and output would be helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 17:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-Statement/m-p/170650#M264225</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-06T17:38:28Z</dc:date>
    </item>
  </channel>
</rss>

