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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 2017 views
  • 0 likes
  • 2 in conversation