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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1740 views
  • 0 likes
  • 4 in conversation