Hi everyone,
I need to calculate the unknown discount rate r in the equation below, all the other variables in the model are known.
Anyone knows how to solve the equation below using PROC IML, Froot function please?
A data sample looks like below:
data test; input stock$ y B P F g; datalines; A 1 12.1492 80.16 3.8886 0.3038 A 2 15.3785 63.54 4.8659 0.3769 A 3 11.5507 41.19 4.5454 0.205 A 4 15.1777 35.28 4.3858 0.1478 A 5 14.9545 52 5.7079 0.0644 A 6 15.8837 50.78 6.1861 -0.0636 A 7 19.3065 67.64 6.7226 -0.0915 A 8 21.6415 72.05 7.7686 -0.0553 A 9 23.6561 74.51 8.804 0.0005 A 10 27.2373 43.05 9.0739 0.123 B 1 6.3668 37.8 2.7893 0.3038 B 2 7.6967 35.4 3.238 0.3769 B 3 8.6812 29.3 3.2122 0.205 B 4 8.999 30.9 3.2352 0.1478 B 5 9.5064 29.75 3.5381 0.0644 B 6 10.1293 39.3 3.4308 -0.0636 B 7 12.2344 43.3 3.7561 -0.0915 B 8 13.2885 52 4.2523 -0.0553 B 9 13.9864 41.6 4.7464 0.0005 B 10 14.043 50.2 4.2598 0.123 C 1 1.4639 24.19 0.3939 0.3038 C 2 2.3384 19.52 1.3403 0.3769 C 3 2.626 7.96 -1.0251 0.205 C 4 2.7283 15.72 0.3156 0.1478 C 5 2.3651 11.81 0.049 0.0644 C 6 2.8771 16.9 0.964 -0.0636 C 7 3.532 18.84 1.1485 -0.0915 C 8 4.5199 21.66 2.0169 -0.0553 C 9 4.379 12.75 2.0582 0.0005 C 10 4.6028 24 0.9412 0.123 ;
If you know the solution to the problem, please comment, thank you very much.
Another member has already helped me finding the solution using Proc fcmp.
https://communities.sas.com/t5/SAS-Programming/Solving-Equation/m-p/766280#M242843
I am wondering if someone can help me to find solution using Proc IML. Thank you very much.
That is a strange formula. Usually time series formulas use "lags," but yours has "leads." You have to tell us how you intend to evaluate the equation at the end of the time series. Your example data has y=1:10. Tell us how you want to evaluate expressions such as F_{y+tau} when y=10, for tau=1:5. When I look at your formula for y=10, I see
p_10 = B_10 + (TERMS_I_CANT_EVALUATE)
Do you only want solutions for y<=5?
Hi Rick,
Thank you very much.
Yes, solution for y<=5 would be great, assuming the first 5 year are known data, last 5 year are forecast data.
Please let me know if you need more information, thank you for the help.
In the formula, the rate, r, does not have a subscript, so the equations imply that there is a single value of r that solves these equations simultaneously for all values of the time index, y. However, in the previous thread, you marked a correct solution, and that program computes a different rate for each value of the time index. Is that really what you want? Or are you trying to find a value of r that solves the equations in a least-squares sense?
So, I guess I am confused by whether the equation is supposed to be solved FOR EACH index, y, or for ALL indices simultaneously, which requires finding a least-squares solution.
I am also wondering why you want to solve this problem by using SAS/IML, if you already have a solution by using the DATA step? What are you hoping to gain from a second solution?
Thank you very much for the comment.
In the equation, p, denote the stock price; r, denote a discount rate; all the vars (p,B,F,g,r) are specific to each stock.
By solving the equation, I want to estimate the values of r, for each stock and year (y).
I want a solution using proc IML because it is advised that it’s most suitable to solve problems like this. I want to learn how to use porc IML for this equation, with the hope to solve other problems like this. It’s a learning process for me, and hope the solution can benefit other SAS users as well.
Please feel free to comment if more info needed, thank you for the help.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.