SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ralizadeh
Obsidian | Level 7

Is there a way in SAS EG to find duplicated values? Must have duplicated rows in CIN and YY columns but have distinct MM. And I need all three columns in the output. Example data below:

 

ralizadeh_2-1683760988545.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ralizadeh
Obsidian | Level 7

Thanks @LinusH. Just to confirm, did you mean that I should add CIN, YY, MM to the Select Data (columns) in the Query Builder, then use COUNT as a summary function for MM. Then add CIN, YY to the Group By. Add Count(*) >1 to HAVING clause under Filter tab?

View solution in original post

4 REPLIES 4
LinusH
Tourmaline | Level 20

If you want to this using UI rather than direct programming, try Query Builder, by defining CIN and YY as grouping variables, and with a having filter on count(*) > 1.

Data never sleeps
ralizadeh
Obsidian | Level 7

Thanks @LinusH. Just to confirm, did you mean that I should add CIN, YY, MM to the Select Data (columns) in the Query Builder, then use COUNT as a summary function for MM. Then add CIN, YY to the Group By. Add Count(*) >1 to HAVING clause under Filter tab?

LinusH
Tourmaline | Level 20

I think so, I don't have access to EG right now so I can't verify.

But you should end up in a SQL similar to:

proc sql;
   select cin, yy, mm
   from have
   group by cin, yy
   having count(*) > 1;
quit;
Data never sleeps
ralizadeh
Obsidian | Level 7

Thanks @LinusH While my original goal was to identify the duplicate row values, your suggestion proved to be valuable in a broader sense. It allowed me to at least determine the count of rows with duplicate values.

 

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4 replies
  • 1988 views
  • 1 like
  • 2 in conversation