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-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!

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.

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