xxxxxxxxxx
proc sort data=sashelp.cars out=cars;
by Make DriveTrain Cylinders;
run;
data cars;
set cars;
by Make DriveTrain Cylinders;
if first.Cylinders then grp_id + 1;
* this answer gives you bonus information ! ;
if first.Cylinders
then seq_in_group = 1;
else seq_in_group + 1;
run;