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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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