Hi,
I remember that there is a quick way to do SQL to accomplish the merge 2 datasets as I did below.
I just cant figure out what is the syntax, basically, I dont need to use the variable x=1;
Thank you,
HC
data a;
input number;
datalines;
1
3
102
;run;
data b;
input name1 :$5. ;
datalines;
new1
new2
;run;
data a; set a; x=1; run;
data b; set b; x=1; run;
proc sql;
create table want (drop=x)as select * from a join b
on a.x=b.x;quit;
Change the "ON" expression to any tautology:
data a;
input number;
datalines;
1
3
102
;run;
data b;
input name1 :$5. ;
datalines;
new1
new2
;run;
proc sql;
create table want as select * from a join b on 1=1;
quit;
In fact you could say "ON 0=0" or "ON 1>0".
Change the "ON" expression to any tautology:
data a;
input number;
datalines;
1
3
102
;run;
data b;
input name1 :$5. ;
datalines;
new1
new2
;run;
proc sql;
create table want as select * from a join b on 1=1;
quit;
In fact you could say "ON 0=0" or "ON 1>0".
Thank you,
nice trick.
HC
Are you just looking for this? Just create data sets A and B, and don't create X:
proc sql;
create table want as select * from a, b;
quit;
YES, it is what I am looking for.
from a, b;
Thanks,
HC
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.