Hello Experts,
I would like replace the set of two tables by proc sql. Do I need to write full join statement to do that?
I mean, I would like to put two tables one after the other.
Thank you!
OUTER UNION seems to work in this case.
Did you use OUTER JOIN or OUTER UNION?
When you use outer union datasets get appended, and all variables are kept (if only UNION, only common variables from input datasets will be kept), and CORR option will align common variables.
And your error is referring to your syntax, most likely you write OUTER JOIN, instead of OUTER UNION.
data T1 T2;
input A B C D E F;
if mod(_N_,2) then output T1;
else output T2;
cards;
1 2 3 4 5 6
2 3 4 5 6 7
3 4 5 6 7 8
4 5 6 7 8 9
5 6 7 8 9 0
;
run;
data t12_ds;
set t1 t2;
run;
proc sql;
create table t12_sql as
select * from T1
union ALL
select * from T2
;
quit;
It's called Maxim#4
proc sql;
create table t12_sql as
(
select t1.*
from T1
left join T3
on t1.A=t3.A
)
union ALL
select * from T2
;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: