One of the variables in my panel dataset has only 1 observation every 5 years, which limits my possibilities for analysis.
Since it is reasonable to assume that this variable changes slowly over time, I would like to fill in the gaps following a function which is basically a straight line between the two values. How can I do this?
Just to be clear, I have something like this:
Year _ Variable
1 ____ 2
2 _____ .
3 _____ .
4 _____ .
5 _____ 10
And I want to fill the gaps with a linear function between the points as to have:
Year _ Variable
1 ____ 2
2 ____ 4
3 ____ 6
4 ____ 8
5 _____10
Of course I have to repeat this for about 9000 observations so I need some sort of loop.
Any ideas?
Thanks in advance for your help.
Giuseppe
Since it is reasonable to assume that this variable changes slowly over time, I would like to fill in the gaps following a function which is basically a straight line between the two values. How can I do this?
Just to be clear, I have something like this:
Year _ Variable
1 ____ 2
2 _____ .
3 _____ .
4 _____ .
5 _____ 10
And I want to fill the gaps with a linear function between the points as to have:
Year _ Variable
1 ____ 2
2 ____ 4
3 ____ 6
4 ____ 8
5 _____10
Of course I have to repeat this for about 9000 observations so I need some sort of loop.
Any ideas?
Thanks in advance for your help.
Giuseppe
Comment