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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.