Hi,
i have two data sets and i want final data set to have all cust_1 corresponding values to cust;
please see below inputs and outputs.
data 1;
cust
123
456
789
012
data2;
cust_1
345
678
901
desired output ;
cust cust_1
123 345
456 345
789 345
012 345
123 678
456 678
789 678
012 678
123 901
456 901
789 901
012 901
thanks
For many-to-many, all combinations matching, SQL is simplest:
proc sql;
create table want as select * from data1, data2;
quit;
I won't be able to actually run any tests until Monday. But you can help by explaining what you mean when you say it doesn't give you the desired output.
Did you get an error message?
DId you get output that was different than what you wanted?
In either case, show any helpful information (starting with the log from your test).
Hi,
@Astounding's code is correct.
data one;
input cust $;
cards;
123
456
789
012
;
run;
data two;
input cust_1 $;
cards;
345
678
901
;
run;
proc sql;
create table want as select * from one, two;
quit;
- Cheers -
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.