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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 994 views
  • 1 like
  • 2 in conversation