BookmarkSubscribeRSS Feed
milts
Pyrite | Level 9
hi! how can you combine duplicates(not summing them up) using data step or proc sql? advance thanks! 🙂
5 REPLIES 5
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
What is meant by "combine"? A SAS MERGE (using a BY) within a DATA step or a PROC SQL with a JOIN operation in a SELECT, come to mind. You mentioned specifically that no "summing" was involved.

Maybe explain in more detail the objective with combining duplicates -- also, consider that if there are duplicates (multiple as in more than 2 obs/rows with the same BY key variables, how will this condition be handled with combining rows?

Need more detail about your objective -- show some BEFORE and AFTER data rows in a post/reply.

Scott Barry
SBBWorks, Inc.
milts
Pyrite | Level 9
anyway i got it now. just use the nodup on proc sort 😃
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Keep in mind the NODUPKEY (limited to BY variable list) option in addition (requires duplicate observations to be adjacent for them to be removed, based on the BY list granularity).

And, if you want to preserve the duplicate observations, there is a DUPOUT= keyword.

Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Please disregard the incomplete prior reply...let's try this again:

Keep in mind the NODUPKEY (limited to BY variable list) option. Also, note that the NODUP option requires duplicate observations to be adjacent for them to be removed, which would be based on the BY list granularity.

And, if you want to preserve the duplicate observations, there is a DUPOUT= keyword.

Scott Barry
SBBWorks, Inc.
milts
Pyrite | Level 9
got that 😃 thanks for the additional information on nodupkey and dupout.

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 1904 views
  • 0 likes
  • 2 in conversation