Good afternoon, I'm working on my master thesis in Statistics at University of Bologna and I have a problem with my code. I have a dataset as shown in attachment.
I'd like to remove observation within each level of id, when the variable event[_n-1]==0.
For example, i'd like to get:
id event
1 1
1 1
1 0
2 1
2 1
2 1
2 0
and so on.
I tried so many options, but they never worked, I'd like to know if there is a solution.
Thanks a lot.
Anna