Ammonite | Level 13

## How to interleave two unrelated data?

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
;``````

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: How to interleave two unrelated data?

cross join.

``````proc sql;

create table want as
select *
from a
cross join b
;
quit;``````
2 REPLIES 2
Tourmaline | Level 20

## Re: How to interleave two unrelated data?

Doesn't sound like interleaving as I know it.
You simple want to create a Cartesian product, do a SQL join without specifying a join criteria.
Data never sleeps
Super User

## Re: How to interleave two unrelated data?

cross join.

``````proc sql;

create table want as
select *
from a
cross join b
;
quit;``````
Discussion stats
• 2 replies
• 1025 views
• 1 like
• 3 in conversation