Normally I merge datasets using a key. However, in this case I don't have or want a key. I want to get a new dataset that combines each row from both. Here's an example with two datasets:
Data1:
Fld1:
A
B
Data2:
Fld2:
1
2
3
I want to get:
Data3:
Fld1: Fld2:
A 1
A 2
A 3
B 1
B 2
B 3
How do I achieve this? Nothing I've tried so far has worked Thanks!
"All combinations" is a simple task for SQL:
proc sql;
create table data3 as select * from data1, data2;
quit;
"All combinations" is a simple task for SQL:
proc sql;
create table data3 as select * from data1, data2;
quit;
Thanks! This did the trick!
DATA step method:
data A;
var1 = 'A'; output;
var1 = 'B'; output;
run;
data B;
var2 = 1; output;
var2 = 2; output;
var2 = 3; output;
run;
data c;
set A;
do i = 1 to OBSNUM;
set B point = i nobs = OBSNUM;
output;
end;
run;
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.