BookmarkSubscribeRSS Feed
joegee
Calcite | Level 5
Code:
PROC SORT DATA=ND NODUPS;
BY ITEM;
RUN;
PROC SORT DATA=DUPS;
BY ITEM;
RUN;
DATA COMBINE;
MERGE DUPS(IN=OK1) ND(IN=OK2);
BY ITEM;
IF OK1;

The 'ND' dataset should not have any duplicate rcds (log shows several were deleted). So why is log showing: "Note: MERGE statement has more than one data set with repeats of BY values." ???
4 REPLIES 4
Flip
Fluorite | Level 6
NODUPS means the entire record is a duplicate NODUPKEY would rid you of duplicate BY values.
joegee
Calcite | Level 5
DUH - I should know that! Thanks you have turned this Fri 13 into my lucky day...
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Also, consider that in some instances (your input file determined) you must have a sufficient BY variable list to ensure that duplicate observations are sorted to be adjacent, otherwise the duplicates will not be deleted, with NODUPS.

Scott Barry
SBBWorks, Inc.
Peter_C
Rhodochrosite | Level 12
check the lengths of the column/variable ITEM in each of your data sets

2541 - Multiple lengths were specified for the BY variable xxxx by input data sets
http://support.sas.com/kb/2/541.html
SUGI 28: Danger: MERGE Ahead! Warning: BY Variable with Multiple Lengths!
http://www2.sas.com/proceedings/sugi28/098-28.pdf

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
  • 4 replies
  • 1079 views
  • 0 likes
  • 4 in conversation