I tried to create three variables: exit_count, entry_count, and unchanged_count for each month based on id. 1) year1993 month9 is the starting month, so exit_count, entry_count, and unchanged_count are all set to 0. 2) next, compare year1993 month10 with month9, we find that aa, bb, cc are "unchanged", while dd and ee drop out, so they are "exit", and ff does not show up in prior month, so it is "entry". 3) move to year1993 month11, compared with year1993 month10, only bb, cc are "unchanged", and aa, ff drop out, while dd, ee,gg, and ll are new entry. so, I compare month t with month t-1, to count how many "old" id drop out or remain unchanged, and how many new id show up. Originally, I was thinking to use the rolling 2-month window (e.g., put 1993.9 and 1993.10 together), then count the id, if appear twice put into unchanged group; but if appear only once, it is difficult to tell whether it should be in exit or entry group.
... View more