Dear all,

my data structure looks like this
hhid id year
100 1 1
100 . 1
100 3 1
100 1 2
100 1 2
(I illustrated the duplicates in id in year 2 as this inhibits my solution of counting the number of non-missing id values by hhid and year and compare them with the maximum value of id within hhid and year).

I would like to write a condition whereby I identify the cases for which there is this gap in the spell, as illustrated above by the missing value between 1 and 3. Does someone have an idea?

Thank you!