Solution

Without the by person:, Stata won't know when the data for one person ends and the next person begins. Thus it will compare the first month for any given person with the last month of the person before, and only if their unemployment statuses differ will it mark it as the beginning of a new spell. The result could be a "spell" that is shared by two people!

Last Revised: 1/26/2010