BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
Possible to left join same table twice on different variables? What is the significance of this combination?

Proc sql;
Create table staging.baselii_boo as
Select a.*,
b.BOOUK as ID_TYPE_BOO,
c.BOOUK as BR_ID_TYPE_BOO
from staging.baselii_boo a
left join staging.boouk_id_type_mapping b on a.AMNA_USER_6_1=b.CMS
left join staging.boouk_id_type mapping c on a.BR_nid_type=c.CMS;
quit;

1 REPLY 1
Kurt_Bremser
Super User

It's a lookup for two different variables, using the same lookup table.

Simple technique, often used. But you can make it (much) faster today by loading the lookup table into a hash object and using the two variables as key in two FIND() method calls. Before the advent of the hash, we would often create a format from the lookup table and apply that twice.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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
  • 1 reply
  • 1317 views
  • 1 like
  • 2 in conversation