How to create (is it interleaving problem?) data 'want' from two unrelated data as shown below? In my real data context, the first dataset has 836 unique rows where I'd like to link the second dataset of 210 rows to each row. Sum of resulting number of rows in 'want' dataset would then become n=175,560.
data have1;
input ob1;
datalines;
1
2
3
;
data have2;
input ob2;
datalines;
8
9
;
data want;
input ob1 ob2;
datalines;
1 8
1 9
2 8
2 9
3 8
3 9
;
cross join.
proc sql;
create table want as
select *
from a
cross join b
;
quit;
cross join.
proc sql;
create table want as
select *
from a
cross join b
;
quit;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.