## How to interleave two unrelated data?

Solved
Super Contributor
Posts: 321

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

Accepted Solutions
Solution
‎01-30-2018 12:01 PM
Super User
Posts: 23,228

## Re: How to interleave two unrelated data?

cross join.

proc sql;

create table want as
select *
from a
cross join b
;
quit;

All Replies
Super User
Posts: 5,849

## 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
Solution
‎01-30-2018 12:01 PM
Super User
Posts: 23,228

## Re: How to interleave two unrelated data?

cross join.

proc sql;

create table want as
select *
from a
cross join b
;
quit;
☑ This topic is solved.