BookmarkSubscribeRSS Feed
nikhilbajaj
Calcite | Level 5

Hi all,

I am getting a weired output while using the 'except all' command. I have (A join B) as source and C as target.

(A join B) has same number of records as in C

if I do a 'except all' between C and (A join B) I get no records

but when I do 'except all' between (A join B) and C I get 37 records. And these records are actually not seen in (A join B).

Can anybody take me out of this problem?

5 REPLIES 5
ballardw
Super User

Might help to actually post the code involved.

nikhilbajaj
Calcite | Level 5

here is the code-

 

rsubmit;
proc sql;
create table TEST_RESULT as
select B.OFFRG_N,
B.OFFRG_TS,
A.AG_PER_POL_L
from MPTST031_UWS_POL A, CSTST061_UWS_CB_CV B
where A.POL_N = B.POL_N

except

select OFFRG_N,
OFFRG_TM_CRT_TS,
AG_PER_POL_L
from CCTRP121_CSIX;
select count(*) from TEST_RESULT;
quit;

nikhilbajaj
Calcite | Level 5

hey guys, today I am not getting that unexpected output. I have no idea why this happened. But anyways thanks and sorry if you put your time on this.

Howles
Quartz | Level 8

Don't know what was expected, but the EXCEPT operator is not commutative.

Ksharp
Super User

Maybe you should uniform these variables name .   These two set of variables should be the same name .

Just Guest.

Xia Keshan

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 1763 views
  • 0 likes
  • 4 in conversation