Hi all,
I am fairly new to the advanced functionality of DMStudio and I am trying to set up a new data job that requires clustering of data and surviving record identification.
My input looks something like the below table.
e1 | a |
e1 | a |
e1 | a |
e2 | b |
e2 | b |
e3 | c |
e3 | c |
e3 | c |
I would like to have as output only the records that are repeated 3 times
e1 | a |
e3 | c |
Any ideas about what I could use to do so?
Thank you in advance,
Cristina
Cristina,
If you are querying a database directly, SQL can do this for you. DM Studio you can create an expression to help with this. Once you cluster the records, add an expression node which will return only clusters containing 3 records:
Job:
Clustering:
Desired Output:
Expression configuration (Grouping):
Expression configuration (Expression Logic):
-shawn
Cristina,
If you are querying a database directly, SQL can do this for you. DM Studio you can create an expression to help with this. Once you cluster the records, add an expression node which will return only clusters containing 3 records:
Job:
Clustering:
Desired Output:
Expression configuration (Grouping):
Expression configuration (Expression Logic):
-shawn
Hi Shawn,
Have you added any additional conditions?
My output is just:
Thanks again,
Cristina
When you are clustering, are you sorting by the cluster id? Does your cluster output resemble my second screenshot? Also, make sure in the expression, that you have indicated that you are grouping by the sorted cluster id.
My fault, I didn't see the grouping by cluster_id - never used the functionality before.
Thank you very much, it all works great now.
Best wishes,
Cristina
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.