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

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

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
  • 3 replies
  • 262 views
  • 0 likes
  • 4 in conversation