Hi! I have data like the following: ID y_9132 y_9133 .... y_0001 ..... y_1604 10302 621 621 .... 998 998 10303 111 112 ... 111 111 Such that, individual 10302 has the status 621 for some time, and then he makes a transtion into another state. The label y_yyww stands for the year and weeknr, such that y_9132 means weeknr 32 in the year 1991. I want the data: ID spellnr duration exit 10302 1 1 0 10302 1 2 0 10302 1 3 0 ... 10302 1 15 1 10302 2 1 0 .... 10303 1 1 0 ... osv Such that the individual is asked each week what state he is in up until he makes a transition. Then I want to count the next spell as spellnr 2 and so on for all individuals. Thanks!
... View more