BookmarkSubscribeRSS Feed
Sathya3
Obsidian | Level 7

What is better way of doing this which takes less processing time? My actual data is huge and since below code produces cartesian product it is taking very large amount of time for processing.Below is sampel data

 

data one ;

datalines;

id name $;

100 sam

200 ram

;

run;

 

data two ;

datalines;

id name $;

100 sam

200 ram

300 paul

;

run;

 

Proc sql;

create table temp as

select b.id,b.name from 

one a,

two b

where a.id NE b.id;

quit;

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

A very recent and long thread on Cartesian joins

https://communities.sas.com/t5/SAS-Programming/NOTE-The-execution-of-this-query-involves-performing-...

 

Basically, if it has to be a Cartesian join, you can't optimize it and you can't speed it up. So the real question is ... can this be done without a Cartesian join? Please let us know.

--
Paige Miller
LinusH
Tourmaline | Level 20

Are both tables huge?

If not, the smaller table may fit into memory and then you could use the hash object in the datastep/proc ds2.

 

Data never sleeps
PGStats
Opal | Level 21

What operation are you trying to perform (in words).

PG

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1075 views
  • 0 likes
  • 4 in conversation