Dear Statalist.
I am trying to generate a variable *wanted* that takes on the value of 1 for each actor_id, and all subsequent observations for each actor_id, that experiences event == 1. Event == 1 may occur several times in the panel for a given actor_id, so I am trying to generate *wanted* based on the first occurrence of event==1 for each actor_id.
My data structure looks like this:
Any and all input on this problem would be much appreciated.
Thank you so much.
Regards,
Erik
I am trying to generate a variable *wanted* that takes on the value of 1 for each actor_id, and all subsequent observations for each actor_id, that experiences event == 1. Event == 1 may occur several times in the panel for a given actor_id, so I am trying to generate *wanted* based on the first occurrence of event==1 for each actor_id.
My data structure looks like this:
time | group_id | actor_id | event | wanted |
1 | 1 | 1 | ||
1 | 1 | 2 | ||
1 | 2 | 3 | ||
1 | 2 | 4 | 1 | 1 |
2 | 3 | 1 | 1 | 1 |
2 | 3 | 5 | ||
2 | 3 | 3 | ||
2 | 4 | 4 | 1 | |
2 | 4 | 8 | ||
3 | 5 | 1 | 1 | |
3 | 5 | 2 | ||
3 | 6 | 3 | ||
3 | 6 | 4 | 1 | 1 |
Any and all input on this problem would be much appreciated.
Thank you so much.
Regards,
Erik
Comment