BookmarkSubscribeRSS Feed
KyleS83
Calcite | Level 5
Suppose I have this for my data and program

data a;
input x y;
cards;
1 10
1 10
2 200
3 30
;
run;

data b;
input x z ;
cards;
1 100
2 200
2 200
4 400
;
run;

proc sql;
select * from a
except all corr
select * from b;
quit;


the results will be X with values 1 and 3. My question is how come the 1 will show up and only once if ALL and CORR are used.
3 REPLIES 3
Howles
Quartz | Level 8
See SQL Set Operators: So Handy Venn You Need Them (http://howles.com/saspapers/242-31/242-31.pdf).
Ksharp
Super User
Based on my knowledge.
All means keep all the duplicated observation and corresponding means matched with the same column.
So once you use all ,then sql will keep duplicated obs, there is only one "1 10" deleted.If you remove all or delete one of "1 10" ,then you will get what you want.


Ksharp
adibhatl018
Calcite | Level 5

Using the Keyword CORR with the EXCEPT Operator

To display both of the following

  • only columns that have the samename
  • all uniquerows in the first table that do not appear in the second table
  • These are the outputs you generate with various combinations

EXCEPT  Except ALL    EXCEPT all corr

x   y            x   y                x

1  10           1  10               1

3  30           1  10               3

                  3  30

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
  • 3 replies
  • 16411 views
  • 0 likes
  • 4 in conversation