Answers for "sas create group id by multiple columns"

0

sas create group id by multiple columns

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;
Posted by: Guest on April-28-2022

Code answers related to "sas create group id by multiple columns"

Browse Popular Code Answers by Language