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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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