turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- HELP!!! COMPOUND Monthly Return

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-04-2014 08:27 PM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-04-2014 08:44 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-04-2014 09:03 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-04-2014 09:42 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-04-2014 10:06 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-04-2014 10:44 PM

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**;