Hallo all together,
I have a short question. It would be great if someone could help me.
My data looks a follows. I have some events happening on a specific date in Time for several IDs. Now I want to find out if EVENT2 happens in an specific time frame of EVENT1 e.g. Minus 5 days, plus 5 Days. IF Yes I want to have a Dummy with 1 in the Line of OBS of EVENT1, otherwise 0.
E.g.
Desired Output
Maybe someone of you guys can help me. Would be great.
Thanks in advance
I have a short question. It would be great if someone could help me.
My data looks a follows. I have some events happening on a specific date in Time for several IDs. Now I want to find out if EVENT2 happens in an specific time frame of EVENT1 e.g. Minus 5 days, plus 5 Days. IF Yes I want to have a Dummy with 1 in the Line of OBS of EVENT1, otherwise 0.
E.g.
Code:
ID DATE EVENT1 EVENT2
1 15.10.2003 YES
1 16.10.2003 YES
1 14.02.2004 YES
1 17.02.2004 YES
1 16.05.2005 YES
1 16.05.2005 YES
2 16.10.2003 YES
2 17.10.2003 YES
2 15.02.2004 YES
2 18.02.2004 YES
2 17.05.2005 YES
2 17.05.2005 YES
Desired Output
Code:
ID DATE EVENT1 EVENT2 DUM
1 15.10.2003 YES 1
1 16.10.2003 YES
1 14.02.2004 YES 0
1 17.02.2004 YES
1 16.05.2005 YES 1
1 16.05.2005 YES
2 16.10.2003 YES
2 17.10.2003 YES 1
2 15.02.2004 YES
2 18.02.2004 YES 0
2 17.05.2005 YES
2 17.05.2005 YES 1
Maybe someone of you guys can help me. Would be great.
Thanks in advance