I presume you are trying to compare differences arising from varying frequency of compounding using the same annual interest rate.
If you want yearly values (as opposed to just the final value), I would recommend a loop for Y=1 to 25. The annual "compounding" is trivial, because it is effectively a simple interest rate. The monthly compounding (within each year) just needs the compound function, applying a rate of .07/12 and number of intervals=12.
data want;
Y=0;
amounta=50000;
amountm=amounta; rate=.07;
output;
do Y=1 to 25;
amounta=(1+rate)*amounta;
amountm=compound(amountm,.,rate/12,12);
output;
end;
format amount: comma12.2;
run;
Of course, in the real world each amount might be rounded to the nearest penny at the end of the year, so you would nest each calculation in the round function:
amounta=round((1+rate)*amounta,.01);
amountm=round(compound(amountm,.,rate/12,12),.01);
Finally, if rounding is required monthly, then there is no benefit to the COMPOUND function. You have to make a monthly loop for each year and apply a simple monthly interest:
do Y=1 to 25;
amounta=round((1+rate)*amounta,.01);
do m=1 to 12;
amountm=round(amountm*(1+rate/12),.01);
end;
output;
end;
... View more