Thinking more carefully about this, my idea of creating a new variable -seq- is not workable. The reason is that smoking status can change over time in this data, and there is no guarantee that the value of seq generated properly matches up the year for the child with the same year for the parent. So this could break the correspondence. You have to actually have the original year variable.
And fixing it appears a bit more complicated than the original problem. So please post another example of data that includes multiple records for the same person, contains the year variable, and also, for at least one person and year, the data example should contain the mother and father records for that year as well.
And fixing it appears a bit more complicated than the original problem. So please post another example of data that includes multiple records for the same person, contains the year variable, and also, for at least one person and year, the data example should contain the mother and father records for that year as well.
Comment