Hi, I have some data below that i generated using the following code data new2; set new; if id^=lag(id) or v1^=lag(v1) then time+1; else time+0; run; What i am trying to do is have the time variable reset to "1" once the ID variable changes (observation 21 - time "5" ) and for the rest of this dataset where the ID changes. Up until Obs 20 the time variable is correct. Thank you SAS Output SAS Output Obs v1 v2 v3 v4 time 20130610111823 195 0.827831 13.1 1 20130610111823 195 0.765397 13.1 1 20130610111823 195 0.755809 13.1 1 20130610111823 195 0.572855 13.1 1 20130610111823 195 0.734431 13.1 1 20130610111823 217 0.845952 12.7 2 20130610111823 217 0.79176 12.7 2 20130610111823 217 0.767398 12.7 2 20130610111823 217 0.745255 12.7 2 20130610111823 217 0.92218 12.7 2 20130610111823 223 0.747259 13.2 3 20130610111823 223 0.722813 13.2 3 20130610111823 223 0.733111 13.2 3 20130610111823 223 0.795692 13.2 3 20130610111823 223 0.863481 13.2 3 20130610111823 260 0.759839 12.6 4 20130610111823 260 0.72373 12.6 4 20130610111823 260 0.74912 12.6 4 20130610111823 260 0.71509 12.6 4 20130610111823 260 0.816424 12.6 4 20130612092329 254 0.593263 11.1 5 20130612092329 254 0.592495 11.1 5 20130612092329 257 0.578249 7.9 6 20130612092329 257 0.980644 7.9 6 20130612092329 258 0.818048 11 7 20130612092329 258 0.885162 11 7 20130612092329 258 0.793767 11 7 20130612092329 258 0.362111 11.7 7 20130612092329 258 0.539453 11.7 7 20130612092329 258 0.659541 11.9 7
... View more