BookmarkSubscribeRSS Feed
scb
Obsidian | Level 7 scb
Obsidian | Level 7

I have 2 datasets;

 

dataset a

 

Name Age

John  70

Apple 67

June   67

Ewan  43

 

dataset b

 

Location 

London

 

What is the fastest way to get this result? Anyone can help? Thanks.

 

Name Age Location

John  70    London

Apple 67    London

June   67   London

Ewan  43   London

 

2 REPLIES 2
LinusH
Tourmaline | Level 20
Cartesian SQL join.
Data never sleeps
Astounding
PROC Star

Fastest to program?  Fastest to execute?  Fastest to explain how it works?

 

Here's one way:

 

data want;

if _n_=1 then set b;

set a;

run;

 

The full Cartesian product (already suggested) is a short program as well:

 

proc sql;

create table want as select * from a, b;

quit;

 

You can test them on larger data sets and let us know which one is faster.

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
  • 745 views
  • 0 likes
  • 3 in conversation