I’m looking at doing a rather complex data sorting algorithm using temporary tables. Before doing it I’d like to check if this will work. Can I dynamically create a large number of tables e.g. 200 and then merge them together in a set statement dynamically?
I'm looking at using this logic for the set statement
http://support.sas.com/kb/26/010.html
%macro names(prefix,maxnum);
%do i=1 %to &maxnum;
&prefix&i
%end;
;
%mend names;
/* Call the macro on the SET statement */
data all;
set %names(DS,3);
run;
How about a numbered range or name prefix range.
set DS1-DS3;
set DS:;
Also you might find OPEN=DEFER, SET statement option useful. If your DSs qualify.
How about a numbered range or name prefix range.
set DS1-DS3;
set DS:;
Also you might find OPEN=DEFER, SET statement option useful. If your DSs qualify.
Thanks data_null_
I'll go with your syntax. Its good to know the huge set won't be an issue.
It could be that you will run out of memory for data set buffers. That's where open=defer can be useful but only if all the SETS have the exact same variables with the exact same length etc.
If you are careful with the naming there would be no need for a macro. Since they are temporary then great names like Temp1 to Temp200 suggest themselves. if they are all in the same library then you could use:
data want;
set Temp: ;
run;
The : is a list shortcut that says to use all sets that start with Temp.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.