I did a 2018 SESUG paper on a related topic: Emulating FIRST. and LAST. SAS® DATA Step Processing in SQL? Concepts and Review
http://www.lexjansen.com/sesug/2018/SESUG2018_Paper-192_Final_PDF.pdf

SQL can be multi-threaded, and lacks the order relationships present in single-therad access of sequential data sets.