Hi SASusers
I have need to do a credit card interest calculation for the number of months the offer is valid.
Thanks
Here is the input data
card | offer | max mnths | rate | opening_balance | days | min_pct_due |
A | 2.9% for 12 months | 12 | 0.000079 | 11000 | 30 | 0.025 |
B | 1.9% for 6 months | 6 | 0.000052 | 5000 | 30 | 0.025 |
Here is the output data
card | offer | rate | min_pct_due | Month | Days | Opening Balance | Interest | Closing Balance | Minimum Due |
A | 2.9% for 12 months | 0.000079 | 0.025 | 1 | 30 | 11,000 | 27 | 11,027 | 277 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 2 | 30 | 10,750 | 26 | 10,776 | 270 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 3 | 30 | 10,506 | 25 | 10,531 | 264 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 4 | 30 | 10,267 | 25 | 10,291 | 258 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 5 | 30 | 10,033 | 24 | 10,057 | 252 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 6 | 30 | 9,805 | 24 | 9,829 | 247 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 7 | 30 | 9,582 | 23 | 9,605 | 241 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 8 | 30 | 9,364 | 23 | 9,387 | 236 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 9 | 30 | 9,151 | 22 | 9,173 | 230 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 10 | 30 | 8,943 | 22 | 8,964 | 225 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 11 | 30 | 8,739 | 21 | 8,760 | 220 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 12 | 30 | 8,540 | 21 | 8,561 | 215 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 13 | 30 | 8,346 | 20 | 8,366 | 210 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 14 | 30 | 8,156 | 20 | 8,176 | 205 |
A | 2.9% for 12 months | 0.000079 | 0.025 | 15 | 30 | 7,970 | 19 | 7,990 | 201 |
B | 1.9% for 6 months | 0.000052 | 0.025 | 1 | 30 | 5000 | 8 | 5,008 | 126 |
B | 1.9% for 6 months | 0.000052 | 0.025 | 2 | 30 | 4882 | 8 | 4889 | 123 |
B | 1.9% for 6 months | 0.000052 | 0.025 | 3 | 30 | 4766 | 7 | 4773 | 120 |
B | 1.9% for 6 months | 0.000052 | 0.025 | 4 | 30 | 4653 | 7 | 4660 | 118 |
B | 1.9% for 6 months | 0.000052 | 0.025 | 5 | 30 | 4543 | 7 | 4550 | 115 |
B | 1.9% for 6 months | 0.000052 | 0.025 | 6 | 30 | 4435 | 7 | 4442 | 112 |
Hi SASusers
I have sort of figured it out.
proc sort data=have;
by card offer;
data want;
set have
by card Offer;
count=0;
do i=1 to 15 until (count=max_months);
interest_promo='Opening Balance'n*Rate*days;
'Closing Balance'n='Opening Balance'n + interest_promo;
min_due='Closing Balance'n*min_pct_due;
'Opening Balance'n='Closing Balance'n-min_due;
count+1;
output;
end;
run;
But there is a small problem...
my output starts from the value of Opening balance=10,750 instead of the starting value of 11000
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.