The ORDER BY Clause

A Brief Overview

The order of rows in the output of a PROC SQL query cannot be guaranteed, unless you specify a sort order with the ORDER BY clause. Specify the keywords ORDER BY, followed by one or more column names separated by commas.
Figure 1.1 SORT Methods for ORDER BY
SORT Methods for ORDER BY
Without an ORDER BY clause, the order of the output rows is determined by the internal processing of PROC SQL, the default collating sequence of SAS, and your operating environment. Therefore, if you want your result table to appear in a particular order, use the ORDER BY clause. Here are details about sort order:
  • The PROC SQL default sort ...

Get SAS Certified Professional Prep Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.