SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

DI Studio - Sort with keeping first/last

Occasional Contributor
Posts: 9

DI Studio - Sort with keeping first/last

My task in DI Studio is to find first and last observations in a group after a sort transformation (and user written code is a no go) has been applied.


So far I stumbled over the option to use two sequential sorts, the first one creating the sort order and the second one keeping the first observation with the nodupkey option, discarting all others. 

Also the rank transformation cann be used to create a rank order including the numeric rank variable. Keeping the rank 1 observation does the job as well. But it only functions if you sort numeric fields and does not help if you only sort alphanumeric values.


Is there a DI Studio in-house transformations/option in atransformation that lets me keep either first or last observations?

Super User
Posts: 5,849

Re: DI Studio - Sort with keeping first/last

Posted in reply to Alkibiades

Not OOTB that I'm aware of.

But is this really a common task? I usually do the "twin Sort" transformation to achieve this, it's not that ugly.

I feel you when you want to avoid user written code, but if this is a common situation, writing a user written transformation is not that bad...

Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 1 like
  • 2 in conversation