BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

So if B has 581 observations and 34 do not match any ids from A that leaves 547 that do match. The count of 551 matched records means that four extra observations were added by merging with A.  So either one id in B matched to 5 observations in A or some other combination.  To find which ids are appearing in multiple times you can use the FIRST. and LAST. variables that the BY statement will generate.

 

data check;
  merge alldata (in=in1) pubdata3 (in=in2);
  by course;
  if in1 and in2 and not (first.course and last.course);
run;
proc print;
run;
piyushas
Fluorite | Level 6

OMG thank you! Yup that's it.  I introduced duplicates further down in my code, after doing my check for duplicates, and did not catch it.

 

I've been mucking with this for days -thank you!

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
  • 16 replies
  • 1519 views
  • 0 likes
  • 5 in conversation