## HELP!!! COMPOUND Monthly Return

Occasional Contributor
Posts: 13

# HELP!!! COMPOUND Monthly Return

 CompanyA 1.3% 3.9% 1.7% 0.5% 0.1% 3% 4% 5% 1% 0.7% 6% 4.7% Months Jan Feb Mar Apr May June July Aug Sep Oct Nov Dec

if invest 3000 per month, first monthly return =3000*1.013, second monthly return =(3000+3000*1.013)*3.9% etc...

Total investment period: 10 years , how to write the codes?

Super User
Posts: 23,776

## Re: HELP!!! COMPOUND Monthly Return

How does your input data look like? Is it in rows like that? Do you have multiple companies/months?

Occasional Contributor
Posts: 13

## Re: HELP!!! COMPOUND Monthly Return

 CompanyA 1.3% 3.9% 1.7% 0.5% 0.1% 3% 4% 5% 1% 0.7% 6% 4.7% Months Jan Feb Mar Apr May June July Aug Sep Oct Nov Dec

Exactly look like the table above

Question: Every month, \$3000 is invested and the rate of return is based on the past twelve month's pattern.

It requires us to calculate the total return by monthly investment after 10 years.

For example, the monthly return for the first \$3000 invested = \$3000*(1+1.3%),

the accumulated monthly return for the next \$3000 invested = (\$3000*(1+1.3%)+\$3000)*3,9%

Total return by monthly investment after 10 years should be \$2,611,500.69

Super User
Posts: 23,776

## Re: HELP!!! COMPOUND Monthly Return

What do the months represent? Do you have 120 interest rates, 1 per month?

Occasional Contributor
Posts: 13

## Re: HELP!!! COMPOUND Monthly Return

12 interest rates only, keep repeating from Jan to Dec

accumulated monthly return

Jan2000 1.3%              \$3000*(1+1.13)  =                                        \$3039

Feb2000 3,9%              (\$3039+\$3000)*(1+3.9%)  =                         \$6274.521

Mar2000 1.7%              (\$6274.521+\$3000)*(1+1.7%)   =                  \$9432.19

Apr2000 0.5%              (\$9432.19+\$3000)*(1+0.5%)     =                  \$12494.35

.                                           .                                                         .

.                                           .                                                         .

.                                           .                                                         .

Dec2000 4.7%             (\$38989.36+\$3000)*(1+4.7%)   =                  \$43962.86

Jan2001 1.3%              (\$43962.86+\$3000)*(1+1.3%)   =                  \$47573.38

Feb2001 3.9%              (\$47573.38+\$3000)*(1+3.9%)   =                  \$52545.74

.

.

.

Dec2010 4.7%              (\$2491270+\$3000)*(1+4.7%)   =                   \$2611500.69

Super User
Posts: 23,776

## Re: HELP!!! COMPOUND Monthly Return

Your data can't be in that format, you have character and numeric values in the same variable.

Assuming your interest rates have the variable names ir1-ir12, where ir1=January's interest rate and Ir12 = Decembers interest rate something like the following will work. I think you have some calculation mistakes in your example though, an interest rate of 1.3% is 1.013 not 1.13.

data have;

informat ir1-ir12 percent.;

format ir1-ir12 percent8.1;

input company \$ ir1-ir12 ;

cards;

CompanyA 1.3% 3.9% 1.7% 0.5% 0.1% 3% 4% 5% 1% 0.7% 6% 4.7%

;

run;

data want;

set have;

array ir(12) ir1-ir12;

monthly=3000;

value=0;

do i=1 to 10; *for 10 years;

do j=1 to 12; *for 12 months/year;

value=(value+monthly)*(1+ir(j));

end;

output;

end;

run;

Discussion stats
• 5 replies
• 308 views
• 0 likes
• 2 in conversation