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)

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