Good afternoon,
I am doing a financial analysis using different observations from different years and individuals. In this sense, I got a variable called interest that shows the interest level in the corresponding year. So, for a specific year, we got the same value for different individuals. What I need is to create a new variable that shows the total interest from the year i up to the last year (minus the interest from the year i). That is, for the first year, the variable should be equal to the sum of all yearly interest minus the interest for that year (that is, the sum of the interest for the following years), while for the second year, the variable should be equal to the total sum of all years minus the interest of the first and second year of the data. I am going to put a table as an example:
Considering that I got the 3 first columns in Stata, how can I create the fourth one? Thanks in advance
Best,
Alex
I am doing a financial analysis using different observations from different years and individuals. In this sense, I got a variable called interest that shows the interest level in the corresponding year. So, for a specific year, we got the same value for different individuals. What I need is to create a new variable that shows the total interest from the year i up to the last year (minus the interest from the year i). That is, for the first year, the variable should be equal to the sum of all yearly interest minus the interest for that year (that is, the sum of the interest for the following years), while for the second year, the variable should be equal to the total sum of all years minus the interest of the first and second year of the data. I am going to put a table as an example:
n | Year | Yearly Interest | Total Interest from year+1 |
1 | 2006 | 0.1 | 0.21 (that is 0.09 + 0.07 + 0.05) |
2 | 2006 | 0.1 | 0.21 |
3 | 2006 | 0.1 | 0.21 |
4 | 2007 | 0.09 | 0.12 (that is 0.07 + 0.05) |
5 | 2007 | 0.09 | 0.12 |
6 | 2008 | 0.07 | 0.05 (that is 0.05) |
7 | 2008 | 0.07 | 0.05 |
8 | 2009 | 0.05 | 0 |
9 | 2009 | 0.05 | 0 |
Considering that I got the 3 first columns in Stata, how can I create the fourth one? Thanks in advance
Best,
Alex
Comment