SAS Procedures

Help using Base SAS procedures
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 17329 views
  • 0 likes
  • 4 in conversation