I want to do a temporal decomposition using STATA. Assume the following data below where x= y*z
It is not necessary to show the entire decomposition but a crucial step is calculating the changes in the variables:
But this involves subtracting one row from the previous row . However, nearly all the STATA functions refer to expression within a row. How can I create a loop which calculates and generates the variables delta x,y,z?
Thanks!
Rutger
year | x | y | z |
2015 | 8 | 4 | 2 |
2016 | 12 | 3 | 4 |
2017 | 16 | 4 | 4 |
year | x | y | z | delta x | delta y | delta |
2015 | 8 | 4 | 2 | |||
2016 | 12 | 3 | 4 | 4 | -1 | 2 |
2017 | 16 | 4 | 4 | 4 | 1 | 0 |
Thanks!
Rutger
Comment