BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

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
Reeza
Super User

cross join.

 

proc sql;

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

View solution in original post

2 REPLIES 2
LinusH
Tourmaline | Level 20
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
Reeza
Super User

cross join.

 

proc sql;

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1117 views
  • 1 like
  • 3 in conversation