BookmarkSubscribeRSS Feed
Abu_Fudail
Calcite | Level 5

When I join 2 tables in SAS EG using full outer join and include the primary key from the first table in the output, I see missing values in some places because the record for this row exist only in 2nd table and not in 1st table. How to get the primary key from 2nd table to reflect instead of missing value?

1 REPLY 1
TomKari
Onyx | Level 15

I suggest that you don't do that, as the fact that the key value is missing is the indication that the record only contains data from one table, not both.

However, it is easy to create an expression to create a new variable to do exactly that. I tried it with the SASHELP.CLASS dataset, and when I create a new variable whose value is

(coalesce(t1.Name, t2.Name)) AS CombinedKey

it contains the complete set of keys.

Tom

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1688 views
  • 0 likes
  • 2 in conversation