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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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