Hi:
To concatenate tables together (or, in your terms, to join them vertically (as opposed to merging them), you could use either PROC APPEND or a SET statement in a DATA step.
So, if you had these two tables (for example) and they both had the same variables NAME and AGE, then you could contenate them together:
[pre]
TABLE1
NAME AGE
Alan 15
Bob 14
Carla 15
********************
TABLE2
NAME AGE
Dave 17
Edna 16
Fiona 14
********************
[/pre]
...with this program
[pre]
data newtable;
set table1
table2;
run;
[/pre]
would result in NEWTABLE containing:
[pre]
NEWTABLE
NAME AGE
Alan 15
Bob 14
Carla 15
Dave 17
Edna 16
Fiona 14
[/pre]
You could also use PROC APPEND, or PROC SQL.
If you want the list of DATASET names for the SET to be populated dynamically, then you would have to follow Linus' suggestion and investigate the use of DICTIONARY.TABLES and some simple SAS Macro processing (the use of INTO within an SQL query) to give you the names of the tables that you want to concatenate together.
These papers may help you get started on finding out some uses for DICTIONARY.TABLES:
http://www2.sas.com/proceedings/sugi30/070-30.pdf
http://www2.sas.com/proceedings/sugi29/237-29.pdf
http://www.lexjansen.com/pharmasug/2006/tutorials/tu03.pdf
http://www.lexjansen.com/pharmasug/2005/posters/po31.pdf
http://www.sugme.org/sugme_dictionary.pdf
If you know about SAS Macro processing, then the program below should be fairly simple to follow. If you don't know about SAS Macro processing, then I suggest that you investigate and learn about the SAS Macro facility before implementing a production solution.
The program below creates 3 datasets (copies of SASHELP.CLASS) in the WORK library and then the PROC SQL step creates a macro variable containing the names of the files just created based on the LIBNAME='WORK' and MEMNAME contains 'CLASS' (your criteria may be different for choosing). Finally, the macro variable created in the PROC SQL step is used in a SET statement.
cynthia
[pre]
** 1) Make Some Data (you do not need this step);
data class_one;
set sashelp.class;
fileind = 1;
run;
data class_two;
set sashelp.class;
fileind = 2;
run;
data class_three;
set sashelp.class;
fileind = 3;
run;
** 2) Discover names of all "CLASS" files in Work;
** LIBNAME AND MEMNAME values should be uppercased.;
** Your selection criteria (WHERE clause) may be different.;
proc sql;
select catt(libname,'.',memname)
into :alldata separated by ' '
from dictionary.tables
where libname = 'WORK' and
memname contains 'CLASS';
quit;
%put The names of the files to concatenate are: &alldata;
** 3) Use the macro variable created above in a SET statement ;
** and verify that the data was created correctly;
data vertical;
set &alldata;
run;
proc freq data=vertical;
title 'After Macro method';
tables fileind;
run;
[/pre]
cynthia