有一只股票的初始价格(initial_price)和每天的收益率(ret)。现在想从推算出股票每天的价格。
具体算法为:
第1天:Want_1 = initial_price * (1+ret_1) 【注:Want_1是第1天的WANT,ret_1是第1天的ret。】
第2天:Want_2 = want_1 * (1+ret_2)
第3天:Want_3 = want_2 * (1+ret_3)
以此类推
请问SAS如何编程?
| Date | ret | initial_price | WANT |
| 0 |
| 10 | 10
|
| 1 | 0.01 |
| 10.1 |
| 2 | 0.02 |
| 10.302 |
| 3 | 0.03 |
| 10.61106 |
| 4 | 0.04 |
| 11.0355 |
| 5 | 0.05 |
| 11.58728 |
| 6 | 0.06 |
| 12.28251 |
| 7 | 0.07 |
| 13.14229 |