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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 494 views
  • 2 likes
  • 3 in conversation