Hello together.

I am still a beginner and hope you can help me with my – most likely – simple question.

My current data looks similar to the one below:
ID Year Event Time (new)
1 2000 0 t-2
1 2001 0 t-1
1 2002 1 t=0
1 2003 0 t+1
1 2004 0 t+2
2 2000 0 t-3
2 2001 0 t-2
2 2002 0 t-1
2 2003 1 t=0
2 2004 0 t+1
... ... ... ...

ID = It reflects the unique identifier (always 5 equal numbers)

Year = It reflects the years (
always 5 equal numbers)

Event = The event differ in respect to the year (only one event)

"Time" is the new variable I want to create automatically; under consideration of ID, year and event.

Can anyone help me with that?

Thanks! :-)

Konstantin