Sorting data sets in CAS is not even possible, proc sort and order by in proc FEDSQL for example do not exist in CAS.
Be careful using SAS base code in CAS: see running the DATA step in CAS with special attention to RETAIN, LAG, and _N_
https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/2184-2018.pdf
Using SAS Studio on Viya, you can use the 'old' style SAS Base code. But then you are not profiting from the big performance gain in CAS which originates from multiple threading and in-memory processing of data.
... View more