Hi all, Consider the following partial data, dat1: _n_ time state event 1 .94 DC 1 2 .94 PC 0 3 .94 CC 0 4 .94 DP 0 5 .94 UU 0 6 4.85 PC 1 7 4.85 CC 0 8 4.85 DP 0 9 4.85 DC 0 10 4.85 UU 0 11 8.53 DP 1 12 8.53 PC 0 13 8.53 CC 0 14 8.53 DC 0 15 8.53 UU 0 ... ... ... ... There are 5 competiting states: DC, PC, CC, DP and UU. The event indicates which state is observed at that time. I am interested in the DC state, and whenever the DC state occurs, I want to update the event as the next occuring state. I also want to recode all the other events as zero. In this example, on row _n_=1 shows that the DC state has occured (event=1) and the next state that occurred was "PC" (_n_=6) . Therefore, instead of "1" for the event on row _n_=1, I want to change the event as "PC". So, whenever the state is "DC" and the event is "1", I want to sustitute the event value to the next occuring state that has an event of "1". Otherwise, I want the events to be zero. How can I do this? Thanks, Hanjoe.
... View more