Hi SAS experts,
I'm trying to design a loop or a macro that will help me calculate transaction-based fees that are applied in a 'stepped' manner.
Example;
00001-10000 transactions - 0.25c per transaction
10001-25000 transactions - 0.21c per transaction
25001-50000 transactions - 0.20c per transaction
50001 and above - 0.18c per transaction
If 78,000 transactions were processed this month, charge would be,
10,000 x 0.25 = 2,500
15,000 x 0.21 = 3,150
25,000 x 0.20 = 5,000
28,000 x 0.18 = 5,040
Total charges for 78,000 transactions = 15,690
My data set looks something like this;
Date...........type............transactions
Jan-10........MC..............78,000
Feb-10........MC..............72,987
Mar-10........MC..............81,214
Apr-10.........MC.............79,914
Is there a way to transalate this calculation into a sas code/macro. I have many transaction types with their own unique stepped fee rates that I need to apply to the relevant transaction volumes. The stepped fees are available to me in a separate dataset that I can join. Or if its easier I can hard-code the fee bands into the code/macro.
Thanks for any help you can offer.