- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.