%macro names(name= ,number= ); %do n=1 %to &number; &name&n %end; %mend names;
data %names(name=dsn,number=5);
data dsn1 dsn2 dsn3 dsn4 dsn5;
%macro namesx(name=,number=); %do n=1 %to &number; &name.x&n %end; %mend namesx;
data %namesx(name=dsn,number=3);
data dsnx1 dsnx2 dsnx3;