I have excel table and my goal is to convert this table to SAS. The table has almost 100 columns with different statistic formula in each column, when some formulas depend on other columns. This is the small sample of the table: A B C D E 5 |Random number| Year | Normal Gross return | Gross Fund | Gross IRR | | ------------------|------|-------------------------|--------------|------------| 6 | | 0| | | | 7 | 1.294000103 | 1 | -18.13% | 76.96| -18.13% | 8 | -0.330857931 | 2 | 25.50% | 214.55| 9.14% | 9 | -0.003978838 | 3 | 8.55% | 334.92| 8.85% | 10| -0.130874637 | 4 | -6.42% | 401.40| 2.63% | 11 | -0.508842621 | 5 | 9.07% | 540.35| 4.69% | The excel formula to calculate column D (Gross Fund) is: Cell(D7)=D6*(1+C7)+Premium*(1-expenseload)*(1+C7) Niotice, that in this column I have to take value from previous row. "Premium" and "ExpenceLoad" are named ranges in excel. I saw previous topics about Lag function and tried different approaches to solve the problem, but nothing gone well and I don't get the correct result. The current SAS code in my program (Within Data step) is: GrossFund = Lag(GrossFund)*(1+NGrossReturn)+&GrossAnnualPremium*(1-&ExpenceLoad)*(1+NGrossReturn); It returns Nulls only. I need help to find the simplest solution to make the calculation with less steps as possible, because, as I noticed, i need to calculate almost a hundred additional variables. and i don't want the code to be to complicated and unreadable. Thanks in advance!
... View more