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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 619 views
  • 1 like
  • 2 in conversation