I have unbalanced panel data of 600000 plus observations. I have created my Dependent Variable as binary (1 for self employed) and (0 for any other occupational status). Then I am interested to see how many changes are their like how many people have changed their occupational status in the dataset. In this regards when I created a change variable using command ( replace cos= se[_n]- se[_n-1] ), it is also reporting the change when the person id is changed. In simple my question is how I can adjust stata to record the change with same persons ID. Please guide me. Also the base year is not the same, its different for different person id, like for some 1984, for some data start at 1999 etc.