Hello All, I want to flag ID's with consecutive flags as 1 and those without consecutive flags as 0. For example ID 1 is consecutive because it starts from cycle 1 to cycle 4 so I create a flag for ID 1 as 1. However for ID's with no consecutive cycle numbers like ID 2 (its starts from cycle 2 to cycle 5, missing cycle 1) and ID 3 also starts from cycle 8 missing cycles 1-7, I flags these ID's as 0. Is there a way to go about this. Thank you.
Data have;
input ID $1. Cycle;
Datalines;
1 1
1 1
1 2
1 3
1 4
2 3
2 4
2 5
3 8
3 8
;
run;