<?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: Need to adjust the paid amount from non-zero values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878050#M346899</link>
    <description>&lt;P&gt;please feel free to take any date as an example, it hardly matters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we just need see how much a person paid extra and adjust this excessive amount in the past months due (i.e. previous non-zero value).&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 May 2023 15:15:05 GMT</pubDate>
    <dc:creator>Decay2020</dc:creator>
    <dc:date>2023-05-29T15:15:05Z</dc:date>
    <item>
      <title>Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878033#M346891</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below month wise dataset 'have'.&lt;/P&gt;&lt;P&gt;I want data 'final' such that the column 'paid' gets completely netted off (adjust) against non-zero column 'amount_due' and we arrive at coloumn 'final' as shown below in 'final data'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Example:- In may-22, SAM paid 100, this amount should get distributed to non-zero value in 'amount_due' previous months (amount_due - paid).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Have;&lt;BR /&gt;infile cards delimiter = ",";&lt;BR /&gt;input date name$ amount_due paid;&lt;BR /&gt;cards;&lt;/P&gt;&lt;P&gt;44592,Sam,10,0,10&lt;BR /&gt;44620,Sam,20,0,20&lt;BR /&gt;44651,Sam,30,0,20&lt;BR /&gt;44681,Sam,40,0,0&lt;BR /&gt;44712,Sam,50,100,0&lt;BR /&gt;44592,Sally,30,0,30&lt;BR /&gt;44620,Sally,40,0,40&lt;BR /&gt;44651,Sally,50,0,50&lt;BR /&gt;44681,Sally,60,0,30&lt;BR /&gt;44712,Sally,0,10,0&lt;BR /&gt;44742,Sally,20,40,0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Final data :-&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Amount due&lt;/TD&gt;&lt;TD&gt;Paid&lt;/TD&gt;&lt;TD&gt;Final&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;January-22&lt;/TD&gt;&lt;TD&gt;Sam&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;February-22&lt;/TD&gt;&lt;TD&gt;Sam&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;March-22&lt;/TD&gt;&lt;TD&gt;Sam&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;April-22&lt;/TD&gt;&lt;TD&gt;Sam&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;May-22&lt;/TD&gt;&lt;TD&gt;Sam&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;January-22&lt;/TD&gt;&lt;TD&gt;Sally&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;February-22&lt;/TD&gt;&lt;TD&gt;Sally&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;March-22&lt;/TD&gt;&lt;TD&gt;Sally&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;April-22&lt;/TD&gt;&lt;TD&gt;Sally&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;May-22&lt;/TD&gt;&lt;TD&gt;Sally&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;June-22&lt;/TD&gt;&lt;TD&gt;Sally&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope, I am able to explain the problem. Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 13:27:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878033#M346891</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2023-05-29T13:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878044#M346894</link>
      <description>&lt;P&gt;I think that&amp;nbsp; you need to provide a few more rules, not examples, but rules as to how each of your Final values is calculated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, those 'dates' look suspiciously like the numeric values behind Excel or other Microsoft products. To show a value anywhere near "January 22" you need to adjust them. Search the forum for "EXCEL Date" and you should find a number of examples.&lt;/P&gt;
&lt;P&gt;BTW, full dates or month and 4-digit year are clearer to understand.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 15:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878044#M346894</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-05-29T15:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878046#M346896</link>
      <description>&lt;P&gt;Agreeing with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;, I don't see how column FINAL is calculated, we need more comprehensive explanation.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 15:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878046#M346896</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-29T15:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878048#M346897</link>
      <description>&lt;P&gt;Okay, in essence we are computing 'amount_due - paid'.&lt;/P&gt;&lt;P&gt;but if the person has paid more than he due for that month, then the excessive amount gets adjusted in past months due.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 15:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878048#M346897</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2023-05-29T15:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878050#M346899</link>
      <description>&lt;P&gt;please feel free to take any date as an example, it hardly matters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we just need see how much a person paid extra and adjust this excessive amount in the past months due (i.e. previous non-zero value).&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 15:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878050#M346899</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2023-05-29T15:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878059#M346902</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/389613"&gt;@Decay2020&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;please feel free to take any date as an example, it hardly matters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;we just need see how much a person paid extra and adjust this excessive amount in the past months due (i.e. previous non-zero value).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is your disconnect.&amp;nbsp; I do not see any variable in your dataset that has this "past months due" amount.&lt;/P&gt;
&lt;P&gt;Or do you also need to add up the values in the "Amount Due" variable from period to period?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: SAS variable names do not allow spaces.&amp;nbsp; So you probably will want to define some actual variable names for these before doing any real programming.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 16:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878059#M346902</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-29T16:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878069#M346908</link>
      <description>&lt;P&gt;please ignore the space in the variable name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;past months due mean - amount_due in previous months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you see, in may-22, SAM paid 100, and only 50 was due.. so the extra 50 should get adjusted in the previous months. and likewise.&lt;/P&gt;&lt;P&gt;I hope, this makes any sense to you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 17:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878069#M346908</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2023-05-29T17:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878071#M346910</link>
      <description>&lt;P&gt;Again, asking for a more complete and comprehensive explanation.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Why on row 4 is FINAL equal to 0?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Why does SALLY have a FINAL equal to zero for May 22. This has not been explained and is not at all obvious.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 17:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878071#M346910</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-29T17:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878073#M346911</link>
      <description>&lt;P&gt;In row 4, SAM owed &lt;STRONG&gt;40&lt;/STRONG&gt; (amount due) which got adjusted from what he paid in row 5.&amp;nbsp;&lt;BR /&gt;In row 5, he owed 50&amp;nbsp;(amount due) but he paid 100 so this &lt;STRONG&gt;excess amount&lt;/STRONG&gt; i.e. &lt;STRONG&gt;60&lt;/STRONG&gt; (100-40) gets adjusted in row 4. and further the rest&amp;nbsp; that is &lt;STRONG&gt;20&lt;/STRONG&gt; (60-40) gets adjusted in row 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for Sally, in may22, she owed 0 so the final amount is 0. as stated multiple times, we need to adjust the excessive amount to only &lt;STRONG&gt;non-zero&lt;/STRONG&gt; previous dues.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 17:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878073#M346911</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2023-05-29T17:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878085#M346916</link>
      <description>&lt;P&gt;I still don't get what you are saying.&amp;nbsp; It suspect you want to somehow re-write history by modifying an observation you already moved past.&amp;nbsp; That is very difficult I am not at all sure why would care to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also your data step does not make much sense to me.&amp;nbsp; Your input statement is reading fewer variables than you have in your data lines.&amp;nbsp; So it sounds like the first number is the amount they charged today and the last number is the amount they paid back today.&amp;nbsp; I cannot make any sense of that middle number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make a running total that reflects charges and payments just try something like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
  input name $ date :yymmdd. charged paid due ;
  format date yymmdd10.;
cards;
Sally 2022-01-31 30 30 0
Sally 2022-02-28 40 40 0
Sally 2022-03-31 50 50 0
Sally 2022-04-30 60 30 0
Sally 2022-05-31 0 0 10
Sally 2022-06-30 20 0 40
Sam 2022-01-31 10 10 0
Sam 2022-02-28 20 20 0
Sam 2022-03-31 30 20 0
Sam 2022-04-30 40 0 0
Sam 2022-05-31 50 0 100
;

data want ;
  set have;
  by name date ;
  total + charged ;
  if first.name then total=charged;
  total + - paid ;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;OBS    name           date    charged    paid    due    total

  1    Sally    2022-01-31       30       30       0       0
  2    Sally    2022-02-28       40       40       0       0
  3    Sally    2022-03-31       50       50       0       0
  4    Sally    2022-04-30       60       30       0      30
  5    Sally    2022-05-31        0        0      10      30
  6    Sally    2022-06-30       20        0      40      50
  7    Sam      2022-01-31       10       10       0       0
  8    Sam      2022-02-28       20       20       0       0
  9    Sam      2022-03-31       30       20       0      10
 10    Sam      2022-04-30       40        0       0      50
 11    Sam      2022-05-31       50        0     100     100

&lt;/PRE&gt;
&lt;P&gt;But I do not know what to do with those numbers you had in the variable I have labeled "due".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 18:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878085#M346916</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-29T18:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878152#M346945</link>
      <description>please ignore he last column or you can name that column as final.&lt;BR /&gt;we have date, name, amount_due, paid.&lt;BR /&gt;amount_due is the amount due in each month and paid is the amount a person paid.&lt;BR /&gt;we want to subtract the paid amount from amount_due and get the final due amount as given in column 'Final'</description>
      <pubDate>Tue, 30 May 2023 04:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878152#M346945</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2023-05-30T04:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878210#M346963</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Assuming I understood what you are looking for.
*/
data Have;
infile cards delimiter = ",";
input date name$ amount_due paid;
format date yymmdd10.;
cards;
44592,Sam,10,0,10
44620,Sam,20,0,20
44651,Sam,30,0,20
44681,Sam,40,0,0
44712,Sam,50,100,0
44592,Sally,30,0,30
44620,Sally,40,0,40
44651,Sally,50,0,50
44681,Sally,60,0,30
44712,Sally,0,10,0
44742,Sally,20,40,0
;

run;
proc sort data=have out=temp;
by name descending date;
run;
data temp2;
 set temp;
 by name;
 if first.name then do;cum_amount_due=0; cum_paid=0;end;
 cum_amount_due+amount_due; cum_paid+paid;
 balance=cum_paid-cum_amount_due;
run;
data temp3;
 set temp2;
 by name;
want=ifn(balance&amp;gt;=0,0,amount_due);

retain found 0;
if first.name then found=0;
if balance&amp;lt;0 and not found then do;found=1;want=-balance;end;
drop cum_: balance found;
run;
proc sort data=temp3 out=want;
by name date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 May 2023 12:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878210#M346963</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-05-30T12:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878213#M346965</link>
      <description>Thanks Ksharp. I will surely try this. but is there any way of doing this witthout sorting as the data have millions of rows.</description>
      <pubDate>Tue, 30 May 2023 12:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878213#M346965</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2023-05-30T12:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need to adjust the paid amount from non-zero values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878245#M346977</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/389613"&gt;@Decay2020&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;please ignore he last column or you can name that column as final.&lt;BR /&gt;we have date, name, amount_due, paid.&lt;BR /&gt;amount_due is the amount due in each month and paid is the amount a person paid.&lt;BR /&gt;we want to subtract the paid amount from amount_due and get the final due amount as given in column 'Final'&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It still does not make sense. And the numbers you shared do not add up.&amp;nbsp; Please post some more realistic numbers and explain exactly what you want to happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the relationship between the amount due on a given date and the amount due on a prior date?&amp;nbsp; Isn't the amount due something that should be calculated based on the previous balance plus any new charges and minus any payments?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can someone's amount due change from month to month without them either incurring new charges or paying off old debts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you trying to figure out which of the individual charges have been paid off?&amp;nbsp; If so why?&amp;nbsp; How does that add any extra information over just knowing what amount is currently due?&amp;nbsp; For example are you planning on charging interest on the older charges?&amp;nbsp; Or charging different interest rates based on when the charge was incurred?&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 15:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-adjust-the-paid-amount-from-non-zero-values/m-p/878245#M346977</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-30T15:34:48Z</dc:date>
    </item>
  </channel>
</rss>

