BookmarkSubscribeRSS Feed
tejeshwar
Calcite | Level 5
Hi,

I have been using the below query to perform outer join on a column

Proc Sql;

create table All_Acc as select

a.acct,
a.year,
b.acct,
b.sysdate,
b.fin,
b.mnts

from
Accts_abc a full outer join Accts_def b
on a.acct = b.acct
;

The problem now is that any value for acct which is in b and not in a is giving me a null value on that column. Even if i reverse the join condition b on a , it happens for acct values present in a and not in b.

I cant use a MERGE at datastep level (if a or b) since i ll have to sort the above 2 datasets, which I am trying to avoid due to the Temp Space it requires.

Basically, I thought the above PROC SQL should have wrkd the same as merge, and kept acct values whereever it is in the 2 datasets.

Can someone pls suggest a way out.

Thanks
Tej
2 REPLIES 2
LinusH
Tourmaline | Level 20
You should always use COALESCE() function on common columns when performing a full join.

/Linus
Data never sleeps
tejeshwar
Calcite | Level 5
Thanks so much, it resolved my problem to getting null rows on the merging_key

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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