Hi, I am trying to accumulate the total amount by purpose for each bank in this data set, however, I am either only able to obtain the amount based on purpose or bank type itself. Could anyone kindly explain? Thank you.
Data:

My codes on the calculation:
data work.purpose2;
set work.purpose1;
by purpose bank_to;
retain cummulative_value;
if first.purpose then cummulative_value=amount;
else cummulative_value=amount+cummulative_value;
drop amount;
run;
Results output:

The results are supposed to show something like this (By the bank type and purpose):
bank_to purpose cummulative_value
AB Leasing $1234567
AB Insurance $1234567
AB Household $1234567
GH Insurance $1234567
....