Thanks Patrick, MY goal is to impute missing values in a table with five columns each representing a year - the intent is to substitute either the average of the previous and last, or of the next two years. in the case of the first and last year the criteria changes to moving only forward or backward. I made it work using do loops with separate code for the first, middle and last years - your stop idea may be the way to avoid this, I'll give it a try, thank you!
... View more