data t1;
input letter1 $;
cards;
a1
b1
c1
;;;;
data t2;
input letter2 $;
cards;
a2
b2
c2
;;;;
proc sql;
create table want as
select t1.letter1, t2.letter2, catt(t1.letter1, t2.letter2) as comb
from t1, t2;
quit;
That's the quickest coding way.
How do you get 12 as?
What's the logic here, all combinations of a/b/c?
@meckarthik wrote:
Hi , I got two columns
1 aa
2 bb
3 cc
How to code in sas for combination
I want output to look like
1 aa
1 BB
2 aa
12 as
13 bb
123 aa
Etc
All possible combinations
Thanks
data t1;
input letter1 $;
cards;
a1
b1
c1
;;;;
data t2;
input letter2 $;
cards;
a2
b2
c2
;;;;
proc sql;
create table want as
select t1.letter1, t2.letter2, catt(t1.letter1, t2.letter2) as comb
from t1, t2;
quit;
That's the quickest coding way.
Hi, expanded the query for 3 tables and it worked perfectly well. Just waiting for the final sign off!!!
& Thank you so much!
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 save with the early bird rate—just $795!
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.