Help using Base SAS procedures

combining duplicates

Reply
Super Contributor
Posts: 318

combining duplicates

hi! how can you combine duplicates(not summing them up) using data step or proc sql? advance thanks! Smiley Happy
Super Contributor
Super Contributor
Posts: 3,174

Re: combining duplicates

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.
Super Contributor
Posts: 318

Re: combining duplicates

anyway i got it now. just use the nodup on proc sort =)
Super Contributor
Super Contributor
Posts: 3,174

Re: combining duplicates

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.
Super Contributor
Super Contributor
Posts: 3,174

Re: combining duplicates

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.
Super Contributor
Posts: 318

Re: combining duplicates

got that =) thanks for the additional information on nodupkey and dupout.
Ask a Question
Discussion stats
  • 5 replies
  • 148 views
  • 0 likes
  • 2 in conversation