/* define which libname.member table, and by which column */
options mprint mlogic;
%let TABLE=sashelp.cars;
%let COLUMN=origin;
proc sort data=&table out=b nodupkey;
by &COLUMN;
run;
data _null_;
set b end=eof;
call symputx("&COLUMN"||left(_n_),&COLUMN);
call symputx('num'||left(_n_),_n_);
if eof then call symputx('totalnum',_n_);
run;
%macro test;
data %do i=1 %to &totalnum; d&&num&i %end;;
set &table;
%do i= 1 %to &totalnum;
%if &i > 1 %then else;
if &COLUMN = "&&&column&i." then output d&&num&i;
%end;
run;
%mend test;
%test
How about in this way?