Hi! I'm working with a a panel like this
country year employment
I need to use only the employment data of the year 1991, so I'm trying to replace the missing values for that year with the closest value. In the example, I would like to use country1year1992 observation to replace country1year1991 and country2year1990 to replace country2year1991.
So in some cases I need a value that comes before and in other cases a value that comes after, I don't really care which one I use I just need to use the closest.
I'm not looking for and interpolation, I just need the exact same value. Is there any way of doing this?
Thanks!
country year employment
country1 | 1989 | 5 |
country1 | 1990 | . |
country1 | 1991 | . |
country1 | 1992 | 7 |
country2 | 1989 | 4 |
country2 | 1990 | 3 |
country2 | 1991 | . |
country2 | 1992 | . |
country3 | 1989 | 8 |
country3 | 1990 | 2 |
country3 | 1991 | 6 |
country3 | 1992 | 3 |
I need to use only the employment data of the year 1991, so I'm trying to replace the missing values for that year with the closest value. In the example, I would like to use country1year1992 observation to replace country1year1991 and country2year1990 to replace country2year1991.
So in some cases I need a value that comes before and in other cases a value that comes after, I don't really care which one I use I just need to use the closest.
I'm not looking for and interpolation, I just need the exact same value. Is there any way of doing this?
Thanks!
Comment