BookmarkSubscribeRSS Feed
Jagadeesh2907
Obsidian | Level 7

Hi , I am using the below query to join multiple tables using proc sql. Is it possible to perform the same in a data step ? 

Could you please help me translate this in data step? 

 

proc sql;
create table work.cte as
select distinct el.flag,
el.balance,
el.daysdelinq,
c.country,
c.postcode,
a.balance,
a.cl,
a.daysdelinq as daysdelinq_2,
a.schufaindicator,
a.finaccno as acct,
c.customerno,
el.row_no
from work.pes_row el,
pxm.accounts a,
pxm.accxref aref,
pxm.contacts c
where el.finaccno = a.finaccno
and a.acc = aref.acc
and aref.customerno = c.customerno
and a.finaccno in (select finaccno from work.acc_list_cards);
quit;

 

Thank you

1 REPLY 1
Onizuka
Pyrite | Level 9

Are you obliged to do that with data set ?

 

Because you are merging 4 tables.

 

You can do the same in SAS using merge.

 

But it is very long because you have to sort each table by the id and merge 4 times (i think)

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 338 views
  • 0 likes
  • 2 in conversation