Hello. I want to retain a variable value across multiple observations in order to do comparisons. ID Date1 Date2 1 20100101 20100201 1 20100110 1 20100115 1 20100215 2 20100115 20100215 2 20100130 2 20100201 ... I want to create a new variable with value=1 if Date1<=Date2 and value=0 if Date1>Date2 for each ID. I think it requires "retain" but I cannot find the solution.
... View more