Hello
I'm trying to make code with some cash flows and rates data.
The data is as follows
Period CF Rate
1 1,200 0.04
2 1,100 0.05
3 1,000 0.06
Inv : 2,000
I want to get "x" value like this
2,000 = 1,200*(1-0.04*x) + 1,100*(1-0.04x)*(1-0.05x) + 1,000*(1-0.04x)*(1-0.05x)*(1-0.06x)
I use SAS Enterprise Guide that doesn't include proc optmodel, proc iml.
Could anyone help me out??
You can do this with a data step and a RETAIN.
But are you sure your logic as shown is correct or what you want? From what I know of cash flow logic, your formula doesn't look correct.
@YoungSun wrote:
Hello
I'm trying to make code with some cash flows and rates data.
The data is as follows
Period CF Rate
1 1,200 0.04
2 1,100 0.05
3 1,000 0.06
Inv : 2,000
I want to get "x" value like this
2,000 = 1,200*(1-0.04*x) + 1,100*(1-0.04x)*(1-0.05x) + 1,000*(1-0.04x)*(1-0.05x)*(1-0.06x)
I use SAS Enterprise Guide that doesn't include proc optmodel, proc iml.
Could anyone help me out??
Thanks, Reeza
Yes, right~ it's not a typical cash flow logic. It's a special logic.
How can I find "x" value with RETAIN statements??
I interpreted your question incorrectly. This is a problem for NLIN or possibly PROC OPTMODEL. It's also basic math, but that's rusty for me these days :). I believe IML would also work. Do you have the licenses for SAS/IML and SAS/OR?
You can check with:
proc product_status;run;
@YoungSun wrote:
Thanks, Reeza
Yes, right~ it's not a typical cash flow logic. It's a special logic.
How can I find "x" value with RETAIN statements??
I don't have a license for IML or OR.
I'll check the procedure you recommended and if you don't mind I'll ask you again.
Thanks for your kindness.
You could do this in a data step by updating and retaining a cumulative discount rate:
data want;
set have;
retain cum_disc_rate 1;
cum_disc_rate=cum_disc_rate*(1-rate);
cum_disc_cf=cf*cum_disc_rate;
run;
Thanks for your reply but I want to find "x" value.
[2,000 = 1,200*(1-0.04*x) + 1,100*(1-0.04x)*(1-0.05x) + 1,000*(1-0.04x)*(1-0.05x)*(1-0.06x)]
Can I get "x" value by using PROC MODEL with RETAIN??
Thanks. I'll check the posts you recommended.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.