ORDERBY= Table Option

Specifies the columns by which to order the data within a partition.

Category: Table Control
Interaction: Valid only with the PARTITION= table option.
Data source: SASHDAT file

Syntax

ORDERBY=(column-list)
ORDERBY=(column [DESCENDING])

Arguments

column-list

specifies the columns by which to order the data within a partition. The specified column(s) must exist and cannot be partitioning columns. When multiple columns are specified, the column names must be separated by commas.

Details

The ordering is hierarchical. For example, ORDERBY=(A, B) specifies ordering by the values of column B within the ordered values of column A. The order is determined based on the raw value of the columns and uses locale-sensitive collation for character columns.
By default, column values are arranged in ascending order. You achieve descending order by specifying the keyword DESCENDING or DESC after the column name in the column list.

Example

create table sashdat.employees {options partition=(dept)
orderby=(hire_date descending)} as select * from mybase.employees;

See Also

Last updated: February 23, 2017