Chapter Contents

Previous

Next
Data Form and Data Table: _sort

Data Form and Data Table: _sort



Sorts the table by one or more columns using one or more options

Delegated to: Data Set Data Model class


Syntax
Details
Example

Syntax

CALL SEND (object-id, '_sort', column(s)<, /option-1<,...option-n>>);

Argument Type Description
column(s)
C specifies one or more columns by which the table is to be sorted. Columns are separated by blanks. The order of the column names reflects the order in which to sort. The column name should be preceded by the keyword DESCENDING when the column is to be sorted in descending order. Ascending order is assumed unless otherwise specified. You may specify as many columns as you like.

option-1<,...option-n>

C specifies a string that contains one or more sort options to use for the sort. The sort option string must have a slash (/) at the beginning of the string. Sort options are separated by blanks within the string. You may specify as many sort options as you like. Here are some sample option strings:

'/noduplicates'

'/noduplicates nodupkey'



You can use the options in the following list, depending on your operating system:


DIAG

EQUALS

FORCE

LEAVE

LIST MESSAGE

NODUPKEY

NODUPLICATES

NOEQUALS

OUTPUT

REVERSE

SORTSEQ=ASCII | EBCDIC | DANISH | FINNISH | NATIONAL | NORWEGIAN | SWEDISH

SORTSIZE

SORTWKNO

TAGSORT

TRANTAB



Details

SAS views cannot be sorted in place. To sort views, you must specify an output table.

If you specify the same table as the output table and the input table, then the _sort method treats this as if no output table were specified. It attempts to sort the table in place. To sort the table in place requires that the table be set to edit mode and that it must be able to be opened in member level locking.

The _sort method uses the sorting program that the SAS System supports for your operating system.

The _sort method sets SYSRC for error, note, and warning conditions.

When a permanent or temporary WHERE clause is in effect, the _sort method returns an error.


Example

The following example assumes you have created a frame with a data table named TABLE:
 Note about code
INIT:
   call notify('.', '_getWidget',
               'TABLE', tabid);
   call send(tabid, '_setDataset',
            'sasuser.class', 'edit');
 Note about code
  call send(tabid, '_sort', 'sex descending name',
           '/noduplicates');
return;


Chapter Contents

Previous

Next

Top of Page

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