BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DubsNU
Calcite | Level 5

Ok this is probably pretty simple for a lot of you.

I have two datasets....one called Stuff and the other called Stuff2.

They both have a column called Site with 95% of the same data in it. However Stuff2 has about 200 fewer records than Stuff. I would like to see which records are in Stuff and not in Stuff2 using Site as the key. Is there an easy way to do this? Thanks in advance.


1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Datastep:

Sort stuff by Site

Sort stuff2 by Site

data miss_stuff miss_stuff2;

  merge stuff (in=a) stuff2 (in=b);

  if a and not b then output miss_stuff2;

  if b and not a then output miss_stuff;

run;

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Datastep:

Sort stuff by Site

Sort stuff2 by Site

data miss_stuff miss_stuff2;

  merge stuff (in=a) stuff2 (in=b);

  if a and not b then output miss_stuff2;

  if b and not a then output miss_stuff;

run;

DubsNU
Calcite | Level 5

Hmmm...doesn't seem to be working....the data set I'd expect to have the missing values from Stuff2 has 0 observations. Any ideas?

DubsNU
Calcite | Level 5

Actually,

It was my mistake....it works. Thank you much!

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2099 views
  • 1 like
  • 2 in conversation