Proc rank springs to mind: Base SAS(R) 9.2 Procedures Guide Or coding it in SQL: proc sql; create table WANT as select VAR, count(OTHER_VAR) as CNT from HAVE group by VAR; quit; Where var is the caegorisor, and other_var is the occuring variable. Then you can just take the top x from the resulting dataset.
... View more