I can't figure out to solve one problem.
I have unknown number of tables in one SAS library. I want to make a loop, which goes through them and "UNION ALL" those tables.
Tables are pre-checked and they have the same structure. This tables include historicized data, so therefore it should be Union all. I tried following script, but it searches for all possibilities but does not do UNION ALL.
I appreciate any ideas to solve this.
%macro union_tables(table_name, last_extract);
%do i=1 %to &last_extract.;
select * from data.&table_name&i
union all
%end;
select * from data.&table_name&i
%mend;
proc sql;
create table Full_history as
%union_tables(Table_,1216);
quit;
Thank you in advance.