I was trying the following codes:
proc IML;
do i=1 to 20;
[some codes to execute]
data[i];
end;
QUIT;
So I am expecting to get 20 data sets after completing the do loops. Is it possible in SAS? I can do it using macro, but I do not like to use macro within PROC IML
!
Thanks in advance.
If you have SAS/IML 12.1, which shipped in August 2012 as part of SAS 9.3m2, then you can just enclose the name of each data set in parentheses, like this
proc iml;
names = "Data1":"Data20";
do i = 1 to ncol(names);
x = i;
dsname = names[i]; /* construct each name */
create (dsname) from x;
append from x;
close (dsname);
end;
For a complete program and explanation, see the last example in the article "Read data sets that are specified by an array of names."