Hey guys,

I'm using unbalenced panal data and want to copy missing values for "date of birth". In the first questionnaire they didn't ask for "date of birth". It was added later on (year x), but the variable appears only once per person. To keep the survey on the same size new persons were added year after year. The persons hat to answer the question of "year of birth" always on their first questionnaire (year y).

I tried the comand:

Code:
bysort id (year) : replace Birth = Birth[_n-1] if Birth == -8|-5
but stata replaced all observations of "year of birth" with missing values. I'm, pretty sure that I have to replace [_n-1], but I didn't manage to replace it successfully.

I wish you guys a nice christmas