Dear all,
I have unbalanced panel, and I need to calculate time-average of time-varying variables for period t=2,...,T. i.e. I need to exclude initial period observations when calculating the average. Also, I don't want moving average, the average should be constant for all years for the same person. Please find union dataset as example. I want to have for the first individual for all years average (25+28+31+...)/6, for the second individual for all years average (25+26+28+...)/8, etc. How can I calculate this?
Thank you in advanced.
Best regards,
Aleksandra
I have unbalanced panel, and I need to calculate time-average of time-varying variables for period t=2,...,T. i.e. I need to exclude initial period observations when calculating the average. Also, I don't want moving average, the average should be constant for all years for the same person. Please find union dataset as example. I want to have for the first individual for all years average (25+28+31+...)/6, for the second individual for all years average (25+26+28+...)/8, etc. How can I calculate this?
Thank you in advanced.
Best regards,
Aleksandra
Code:
webuse union
idcode year age
1 72 20
1 77 25
1 80 28
1 83 31
1 85 33
1 87 35
1 88 37
2 71 19
2 77 25
2 78 26
2 80 28
2 82 30
2 83 31
2 85 33
2 87 35
2 88 37

Comment