Data Class; Set Sashelp.class; Output; If _N_= 5 Then Output; Run; Proc Sql; Select name into :AllVar separated by ',' From sashelp.vcolumn Where libname= %Upcase('WORK') and memname= %Upcase('CLASS') ; Select * From Work.Class Group By &AllVar Having Count(*) > 1 ; quit; run;