%let n=5 ; /*n should <=18*/
proc iml;
n = &n;
p = allperm(n);
print p; /* this is the result*/
create jiecheng var{p};
append;
show contents;
close jiecheng;
run;
/* the following step is just for output dataset ;*/
data result;
set jiecheng;
array xxx[&n] a1-a&n;
retain xxx;
count+1;
xxx[count]= p;
if count=&n then do;
call missing (count);
output;
end;
keep a: ;
run;