Hi!
I have the following dataset:
unit_number, Year, costs
I would like to calculate the difference in costs for each unit, and I would to do that for different time intervals. In the dataset I have years 2005-2015. Thus, if I define yearly changes, it works:
But then if I want the 3- year changes it gives me an error:
The error: "time values with period less than delta() found"
So, it is basically telling me that I can get yearly changes instead of 3-year changes. But I am interested in 3 year changes. I do not understand why this is an error and not a warning.
Please let me know how I should fix this.
Thanks!
I have the following dataset:
unit_number, Year, costs
I would like to calculate the difference in costs for each unit, and I would to do that for different time intervals. In the dataset I have years 2005-2015. Thus, if I define yearly changes, it works:
Code:
xtset unit_number Year, delta(1)
gen costs_lead=F.costs
gen diff_costs=costs_lead - costs
Code:
xtset unit_number Year, delta(3) gen costs_lead=F.costs gen diff_costs=costs_lead - costs
So, it is basically telling me that I can get yearly changes instead of 3-year changes. But I am interested in 3 year changes. I do not understand why this is an error and not a warning.
Please let me know how I should fix this.
Thanks!
Comment