In reply to Peter.

Hi Peter,

Yes, SAS Enterprise Guide tasks will sort the data if needed to make BY groups work -- whether that's what you want or not. EG tasks don't want non-programmers to stumble over errors that could be confusing, so the code here is ultra-defensive.

If your data is in a DBMS (or almost anything other than a Base SAS library), EG tasks will NOT sort the data for you in a PROC SORT/SQL preamble, because the ORDER BY is implicitly specified to the database engine.