Here is IML code for going through all the tables in WORK library . much faster than data step.
data have;
input a b c d;
cards;
1 . . .
2 1 . .
3 2 1 .
4 3 2 1
;
run;
data have1;
input a b c d;
cards;
1 . . .
2 1 . .
3 2 1 .
5 3 2 1
;
run;
proc iml;
memname=datasets('WORK');
new_memname=cats('new_',memname);
do j=1 to nrow(memname);
use (memname[j]);
read all var _all_ into x[c=vname];
close;
y=j(nrow(x),ncol(x),.);
do i=1 to ncol(x);
idx_x=loc(x[,i]^=.);
idx_y=1:ncol(idx_x);
y[idx_y,i]=x[idx_x,i];
end;
create (new_memname[j])from y[c=vname];
append from y;
close;
end;
quit;
... View more