<?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 SAS First in first out - Financial calculation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-First-in-first-out-Financial-calculation/m-p/549726#M152585</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Problem&lt;/STRONG&gt;:- I want to create First in First Out (FIFO) calculation in attached spreadsheet. Means All points Earned Under (Earned and Adjusted) column throughout period will be my Starting balance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now Anytime when Account has either Purge or Expire or Redeem points in future period It should deduct from prior Points earned under Earned and Adjusted &amp;nbsp;variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Example, Total earned points at the end of period 200812 will be 15,000 (12,00 from Earn + 3000 from Adjusted column) And 10,250 Debited points (1,500 from Purge, 500 from Expire and 8250 from Redeem column). Means Account has 4,750 points left. (15,000 – 10,250= 4,750).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I need 10,250 points distributed from lower to higher period using FIFO. Means 1,500 points from Purge column should be deducted from the balance of 2,000 points (Earned +Adjusted column) for period 200801 and 200802. After 1500 points deduction we still have balance of 500 which will be used to deduct 500 &lt;STRONG&gt;Expire points&lt;/STRONG&gt;. Now we don’t have any balance left for period 200802. So for &lt;STRONG&gt;redeemed points of 8250&lt;/STRONG&gt; should start deducting from period 200803 onwards. It should deduct the points from earned bucket (Earned +Adjusted) until became zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer attached file for soft copy. Ultimately My desire output is in green on the right side.&lt;/P&gt;
&lt;P&gt;I tried to explain in detail as much as possible but please feel free to revert back if you need any more additional information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The attached excel has the example by every month and how the data is going layout month by month. I have tried to explain 12month scenario, but it can go all the way up to 150 month for one account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2019 17:36:32 GMT</pubDate>
    <dc:creator>Ranny</dc:creator>
    <dc:date>2019-04-09T17:36:32Z</dc:date>
    <item>
      <title>SAS First in first out - Financial calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-First-in-first-out-Financial-calculation/m-p/549726#M152585</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Problem&lt;/STRONG&gt;:- I want to create First in First Out (FIFO) calculation in attached spreadsheet. Means All points Earned Under (Earned and Adjusted) column throughout period will be my Starting balance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now Anytime when Account has either Purge or Expire or Redeem points in future period It should deduct from prior Points earned under Earned and Adjusted &amp;nbsp;variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Example, Total earned points at the end of period 200812 will be 15,000 (12,00 from Earn + 3000 from Adjusted column) And 10,250 Debited points (1,500 from Purge, 500 from Expire and 8250 from Redeem column). Means Account has 4,750 points left. (15,000 – 10,250= 4,750).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I need 10,250 points distributed from lower to higher period using FIFO. Means 1,500 points from Purge column should be deducted from the balance of 2,000 points (Earned +Adjusted column) for period 200801 and 200802. After 1500 points deduction we still have balance of 500 which will be used to deduct 500 &lt;STRONG&gt;Expire points&lt;/STRONG&gt;. Now we don’t have any balance left for period 200802. So for &lt;STRONG&gt;redeemed points of 8250&lt;/STRONG&gt; should start deducting from period 200803 onwards. It should deduct the points from earned bucket (Earned +Adjusted) until became zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer attached file for soft copy. Ultimately My desire output is in green on the right side.&lt;/P&gt;
&lt;P&gt;I tried to explain in detail as much as possible but please feel free to revert back if you need any more additional information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The attached excel has the example by every month and how the data is going layout month by month. I have tried to explain 12month scenario, but it can go all the way up to 150 month for one account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 17:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-First-in-first-out-Financial-calculation/m-p/549726#M152585</guid>
      <dc:creator>Ranny</dc:creator>
      <dc:date>2019-04-09T17:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS First in first out - Financial calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-First-in-first-out-Financial-calculation/m-p/549943#M152659</link>
      <description>&lt;P&gt;Here is some dummy code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set sashelp.class;
 array x{4} _temporary_ ;
 do i=3 to 1 by -1;
  x{i+1}=x{i};
 end;
 x{1}=age;
 put 'FIFO:age=' x{4};
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Apr 2019 13:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-First-in-first-out-Financial-calculation/m-p/549943#M152659</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-04-10T13:24:45Z</dc:date>
    </item>
  </channel>
</rss>

