Chapter Contents


SAS/ACCESS Interface to SYSTEM 2000 Data Management Software: Reference

SYSTEM 2000 Ordering-clause

When you define a view descriptor, you can also include a SYSTEM 2000 ordering-clause to specify data order. You can reference only the items selected for the view descriptor. Without an ordering-clause or a SAS BY statement, the data order is determined by SYSTEM 2000 software.

A SAS BY statement automatically issues an ordering-clause to SYSTEM 2000 software. If a view descriptor already contains an ordering-clause, the BY statement overrides the ordering-clause for that program. An exception is when the SAS procedure includes the NOTSORTED option. Then, the SAS BY statement is ignored, and the view descriptor ordering-clause is used.

Note:   When you include a SYSTEM 2000 ordering-clause in a view descriptor, you can specify a terminator (either a colon or a semicolon). But if you specify both a where-clause and an ordering-clause, do not use a terminator between them.  [cautionend]


ORDERED BY sortkeys;

is the keyword designating an ordering-clause. You can also use ORDER BY, OB, and SORT.

is a component name, component number, or SAS variable name of a SYSTEM 2000 item included in the view descriptor. Use commas to separate sort keys. You can also specify either ascending or descending order for each sort key.

specifies that you want the data ordered by ascending values of the sortkey. Ascending is the default.

specifies that you want the data ordered by descending values of the sortkey.

If you specify more than one SYSTEM 2000 component, the values are ordered by the first named component, then the second, and so on. See SYSTEM 2000 QUEST Language for more details on the ordering-clause.


The following ordering-clause causes the values to be presented in ascending order based on the values in item DEPARTMENT, then within departments in descending order based on the values in item SALARY:

    order by department, desc salary

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.