BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rajeshm
Quartz | Level 8
PROC SQL;
CREATE TABLE onlyfrist AS
SELECT * FROM first
EXCEPT
SELECT * FROM second;
quit;

PROC SQL;
CREATE TABLE onlysecond AS
SELECT * FROM second
EXCEPT
SELECT * FROM first ;
quit;

PROC SQL;
CREATE TABLE firstAndsecond AS
SELECT * FROM first
intersect
SELECT * FROM second;
quit;

my first and second contains 284 records each.

onlyfirst--281

intersect--0

onlysecond--281.  How it is not able to understand. can somebody help me?

Note:  first and second datasets all variables are same including length.

1 ACCEPTED SOLUTION

Accepted Solutions
8 REPLIES 8
rajeshm
Quartz | Level 8

Thanks for the reply. I can't copy my data here.if you think based on data it is possible to get this type of output,please  provide sample data to suit this output. Don't mind.

 

data set A=284 records

data set B=284 records

A Except B=281

B Except A=281

A intersect/intersect all B=0

 

 

Kurt_Bremser
Super User

These two datasets show the effect of duplicates:

data first;
input a $ b;
datalines;
a 1
a 1
b 2
c 3
;

data second;
input a $ b;
datalines;
d 4
d 4
e 5
e 5
;
Ksharp
Super User
Your first and second should contain duplicated obs .
using ALL to retain all the obs .

SELECT * FROM first
intersect all
SELECT * FROM second;
rajeshm
Quartz | Level 8

thanks for the reply.

if you think it is possible to get this type of output please provide sample data which can give this type of result.

data set A=284 records

data set B=284 records

A Except B=281

B Except A=281

A intersect/intersect all B=0

Ksharp
Super User
SELECT * FROM first
EXCEPT ALL
SELECT * FROM second;
rajeshm
Quartz | Level 8

thanks for the reply boss.

Earlier did not get your answer but now...understand your logic

rajeshm
Quartz | Level 8

thanks for the reply boss.

did not realize your logic ..but now fine.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 8 replies
  • 1861 views
  • 2 likes
  • 3 in conversation