I have a data file containing educational test results for students in year levels 3, 5, 7, and 9. Each year level also has a value for "assessed year", based on the calendar year in which the student sat the test (values for calendar year vary by id). However I have many missing values for "assessed year". For each id, each value of assessed year should be 2 years apart. This is what the data should look like:        ID  YearLevel  AssessedYear    1  3  2007    1  5  2009    1  7  2011    1  9  2013    2  3  2009    2  5  2011    2  7  2013    2  9  2015    3  3  2011    3  5  2013    3  7  2015    3  9  2017    4  3  2003    4  5  2005    4  7  2007    4  9  2009    5  3  2003    5  5  2005    5  7  2007    5  9  2009        But this is what I have:     ID  YearLevel  AssessedYear    1  3  .    1  5  2009    1  7  .    1  9  2013    2  3  2009    2  5  2011    2  7  2013    2  9  .    3  3  2011    3  5  .    3  7  .    3  9  .    4  3  .    4  5  2005    4  7  2007    4  9  2009    5  3  .    5  5  .    5  7  .    5  9  2009        I want to fill in the missing cells by calculating +/- 2 years from the non-missing values of assessed year.     Any suggestions will be greatly appreciated, this has been keeping me occupied for some time now!     Thanks 
						
					
					... View more