I need to change the value of variable VarY if Flag=1. This needs to be done within each unique value under variable VarY. Each VarX could have multiple values of VarY corresponding to it. Here VarY takes 734 and 6011 when VarX is 11. For example in the below example, When Flag=1, VarY needs to change to 6011_1 at the first occurrence of 1 in Flag and it needs to become 6011_2 at the second occurrence of 1 in Flag. All the remaining rows under that value of VarY(or until the next occurrence of Flag=1) also need to take the new value of VarY. Could someone please guide me? Input dataset temp: VarX VarY Flag 11 734 . 11 734 . 11 734 . 11 734 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 1 11 6011 . 11 6011 1 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 12 123 . 12 123 1 12 123 . Desired output: VarX VarY Flag 11 734 . 11 734 . 11 734 . 11 734 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011 . 11 6011_1 1 11 6011_1 . 11 6011_2 1 11 6011_2 . 11 6011_2 . 11 6011_2 . 11 6011_2 . 11 6011_2 . 12 123 . 12 123_1 1 12 123_1 . Thank you!
... View more