04-18-2017 01:19 PM
SQL makes no guarantee on ordering. You might be seeing the results of running on multiple threads causing a change in the order.
If you really do not have a set of keys then just order on everything. You can use PROC SORT and the _ALL_ variable list. If you did have some partial keys that you want to order on add those in front of the _ALL_ keyword.
proc sort data=have; by key1 key2 _all_; run;
04-19-2017 06:29 AM
If I can echo what Tom says SQL makes no guarantee of order. In fact the SQL language was designed for relational databases and when I was taught relational database theory (many decades ago) I was told that in an RDBMS order of records should never matter.
If you're running your code against say ORACLE it's possible, as Tom says, that internally ORACLE is threading your query without you realising it.