2022年8月9日星期二

Counting number of duplicated cases by several variables

proc sort data=have(keep=key1 key2);
  by key1 key2;
run;
data want;
  do count=1 by 1 until(last.key2);
    set have;
    by key1 key2;
    end;
run;