There are many business
situations that require two or more tables to be concatenated. For
example, suppose you want to display the employee numbers, job codes,
and salaries of all mechanics working for an airline. The mechanic
job has three levels and there is a separate table containing data
for the mechanics at each level: Sasuser.Mechanicslevel1, Sasuser.Mechanicslevel2,
and Sasuser.Mechanicslevel3. These tables all contain the same three
columns.
The following PROC SQL
step uses two OUTER UNION operators to concatenate the tables, and
the CORR keyword to overlay the columns that have common names:
proc sql;
select *
from sasuser.mechanicslevel1
outer union corr
select *
from sasuser.mechanicslevel2
outer union corr
select *
from sasuser.mechanicslevel3;
|
|