Hi all, I have the below month wise dataset 'have'. 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'. 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). data Have; infile cards delimiter = ","; input date name$ amount_due paid; 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; Final data :- Date Name Amount due Paid Final January-22 Sam 10 0 10 February-22 Sam 20 0 20 March-22 Sam 30 0 20 April-22 Sam 40 0 0 May-22 Sam 50 100 0 January-22 Sally 30 0 30 February-22 Sally 40 0 40 March-22 Sally 50 0 50 April-22 Sally 60 0 30 May-22 Sally 0 10 0 June-22 Sally 20 40 0 I hope, I am able to explain the problem. Thanks in advance.
... View more