Skip to content
Advertisement

concatenating large number of tables in sas

let’s assume i have a large list of tables say :

all these tables have the same column names and number of columns, i want to stack all these tables one under the other in one dataset

i tried to create a macro to do so (because i have multiple other lists that are larger than this but up until now i’ve failed to do so

Advertisement

Answer

If you want to continue to use SQL for this task you will want to properly construct the SQL statement for many tabled UNION ALL.

Do not iteratively ‘append’ one table at time using a single UNION ALL of the stack and next table. Instead do all stacking in a single SQL statement.

Example:

Will code gen

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement