Hi , i will take a real example , hopping this time that it will be clear (and sorry again for bothering). -------------------------------------------------------------------------------------------------------------------------- data HAVE;
input day BANK1 BANK2;
cards;
1 10 60
2 -100 60
3 50 100
4 -30 70
run;
Proc sql noprint ;
select sum(val1) into: sum
from have ;
run ;
/* As the a bank-account can't be < 0 , we must take money from bank2 and put it in bank1*/
/* The total money to be taken is equal to -70*/
So , the SUM (=-70) We must take this money from bank2 and put it in bank1 ==> So more money for BANK1 and less money for BANK2 until we have the following dataset : data WANT;
input day BANK1 BANK2 ValueRetrievedFromTheSUM;
cards;
1 70 0 60
2 -90 50 10
3 50 100 0
4 -30 70 0
run;
... View more