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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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