Hello @wcw2,
You'll need an additional variable (like variable grp in the example below) designating the groups or some other criterion to tell SAS where a new group begins.
data have;
input grp GROUPNO;
cards;
1 6
1 6
1 6
1 5
1 6
1 6
1 6
2 20
2 21
2 20
2 20
2 20
;
data want(drop=_g1);
set have;
by grp; /* add NOTSORTED option if needed */
if first.grp then _g1=groupno;
else if groupno ne _g1 then FLAG='x';
retain _g1;
run;