Hi all,
I have data set of three columns, name, year and age. My purpose is to fill up age record based on year.
The data set looks like,
Name year age
A 1998
A 1999
A 2000 44
A 2001
B 1996 36
B 1997
B 1998
..........................
C 1999
C 2000 38
C 2002
D 1994 33
D 1995 34
D 1996
D 1997
Here is the thing. For a specific person, I can always identify his/her age by year by one or more records, like A, if he is 44 in 2000, then in 1998 and 1999, he should be 42 and 43, respectively.
The problem is that; the identifier (44 in A's case) can show up irregularly. In A's case, it shows up at the 3rd record; in B's case, the age identifier shows up at the 1st place.
Another problem is that, year record can skip. In C's case, it goes from 1999, 2000, and then skip 2001, jumping to 2002 directly.
Basically, I want my data look like,
Name year age
A 1998 42
A 1999 43
A 2000 44
A 2001 45
B 1996 36
B 1997 37
B 1998 38
..........................
C 1999 37
C 2000 38
C 2002 39
D 1994 33
D 1995 34
D 1996 35
D 1997 36
Please help and many thanks!