I have a panel data with to identifiers: ID and Time. The dataset contains the following variables: ID, Time and V1. I want to create a fourth variable Flag which will identify the first date where V1 > 0 for each ID. For eg: The third observations identifies the third month as the first occurrence of a positive V1 for ID = 1. Again the seventh observation identifies the second month as the first occurrence of a positive V1 for ID = 2 . Thanks in advance.
ID Time V1 Flag
1 , 1, 0, 0
1 , 2, 0, 0
1 , 3, 7.5, 3
1 , 4, 6, 0
1 , 5, 0, 0
2 , 1, 0, 0
2 , 2, 9, 2
2 , 3, 9, 0
2 , 4, 0, 0
2 , 5, 2.5, 0
... View more