Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Proc FCMP - How to approximate the internal rate of return?

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 07-03-2016 12:46 PM
(1505 views)

Dear All,

For a project at my university, I like to calculate the internal rate of return for multiple projects. That is, I have data on the "price" of today P, the future monthly Cash flows (CF) for the next 5 years and then a growth assumption for these Cash flows up to infinity. Now, I like to calculate the internal rate of return which discounts the future cash flows to the price of today. I was told its easiest to use proc fcmp for that, but i am not experienced with that...

I uploaded an image of the formula, I need to solve for r - i have data for the rest of the variables.

I'd be super thankful if someone could help me, as I am starting to get desperated 😞

(I am a SAS newbe, please excuse my unawareness of basic things).

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi,

First look at Financial functions in SAS Functions and CALL Routines by Category:

Your required function might be there. If not...

Your cash flow is quite special, so maybe you really need to use PROC FCMP to solve for r.

This is how I would do it:

I'm starting from the SOLVE Function code examples here:

proc fcmp; /* define the present value function*/ function present_value(r, cf1,cf2,cf3,cf4,cf5, cf6_oo);

array cfs[6] cf1 cf2 cf3 cf4 cf5 cf6_oo;

p=0;

do t=1 to 5;

p=p + cfs[t]/(1+r)**t + cfs[t+1]/(r*(r+1)**t); /*This is your formula*/

end;

return (p);

endsub;

function get_r(pv, cf1,cf2,cf3,cf4,cf5, cf6_oo);

r=solve('present_value', {.}, pv, ., cf1,cf2,cf3,cf4,cf5, cf6_oo);

return(r);

endsub;

data want;

set have;

r=get_r(pv, cf1,cf2,cf3,cf4,cf5, cf6_oo);

run;

Note, you might need to specify a starting value for r in the solve() functoon call. (See: {.})

Sorry, I have not run the code - no syntax check at all.

Hope this helps.

Greg

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Do not despair! What parameters would you pass to such a function?

PG

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi,

Well, I got the price of today and the future cash flow amounts in US dollars. The r is the value that is searched for in decimals.

Frieda

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi,

First look at Financial functions in SAS Functions and CALL Routines by Category:

Your required function might be there. If not...

Your cash flow is quite special, so maybe you really need to use PROC FCMP to solve for r.

This is how I would do it:

I'm starting from the SOLVE Function code examples here:

proc fcmp; /* define the present value function*/ function present_value(r, cf1,cf2,cf3,cf4,cf5, cf6_oo);

array cfs[6] cf1 cf2 cf3 cf4 cf5 cf6_oo;

p=0;

do t=1 to 5;

p=p + cfs[t]/(1+r)**t + cfs[t+1]/(r*(r+1)**t); /*This is your formula*/

end;

return (p);

endsub;

function get_r(pv, cf1,cf2,cf3,cf4,cf5, cf6_oo);

r=solve('present_value', {.}, pv, ., cf1,cf2,cf3,cf4,cf5, cf6_oo);

return(r);

endsub;

data want;

set have;

r=get_r(pv, cf1,cf2,cf3,cf4,cf5, cf6_oo);

run;

Note, you might need to specify a starting value for r in the solve() functoon call. (See: {.})

Sorry, I have not run the code - no syntax check at all.

Hope this helps.

Greg

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you! I will try to apply this, and see how far it takes me towards my desired outcome 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

What is Bayesian Analysis?

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.