BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello,

What do you think is more efficient (run time)-

Way1-- Run 2 merge in one proc sql

WAY2- Run 1 merge in one proc sql and then one merge in second proc sql

 

/***WAY1***/
/***WAY1***/
/***WAY1***/
proc sql;
create table WANT as
select  a.*,
		b.Branch_Cust_IP,
		b.Branch_Cust_End_Date    as _Lak_date_Close_ format=ddmmyy10.,
		b.Branch_Cust_Start_Date  as Lak_date_Open  format=ddmmyy10.,
		c.Numerator as lakoach 
from Lak_Heshbon_list as a
inner join teradata.VBM374_USED_BRANCH_CUSTOMER  as b
ON a.LAK_ID=b.Branch_Cust_Nbr and a.snif=b.Branch_Nbr
left join teradata.V01X26_MARKETING_REQ_NUMERATOR  as c
ON b.Branch_Cust_IP=c.Inv_Party_Id 
 ;
quit;


/***WAY2***/
/***WAY2***/
/***WAY2***/
proc sql;
create table ttt_a as
select  a.*,
		b.Branch_Cust_IP,
		b.Branch_Cust_End_Date    as _Lak_date_Close_ format=ddmmyy10.,
		b.Branch_Cust_Start_Date  as Lak_date_Open  format=ddmmyy10.,
		c.Numerator as lakoach
from Lak_Heshbon_list as a
inner join teradata.VBM374_USED_BRANCH_CUSTOMER  as b
ON a.LAK_ID=b.Branch_Cust_Nbr and a.snif=b.Branch_Nbr
 ;
quit;

proc sql;
create table WANT as
select a.*,b.Numerator as lakoach
from   ttt_a as a
left join teradata.V01X26_MARKETING_REQ_NUMERATOR  as b
ON a.Branch_Cust_IP=b.Inv_Party_Id 
;
quit;
4 REPLIES 4
PaigeMiller
Diamond | Level 26

Does not the answer from @Kurt_Bremser to use Maxim 4 apply here?

--
Paige Miller
SASKiwi
PROC Star

Looks like you are joining a SAS table with a Teradata table. If that is the case then neither SQL example is likely to be very efficient as the whole Teradata table has to be extracted to the SAS server before it can do the join with the SAS table. 

Ksharp
Super User
For the sake of security, I would prefer to way2 .

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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