Chapter Contents

Previous

Next
Data Set Data Model: _sort

Data Set Data Model: _sort



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


Syntax
Details
Example

Syntax

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

Argument Type Description
column-list N specifies the identifier of an SCL list that contains the column names by which the table is sorted. The order of the column names in the list determines the order in which the table is sorted. Each column name item in the list should be proceeded by a separate list item with 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 necessary.

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
collist=makelist();
rc=insertc(collist, 'sex', -1);
rc=insertc(collist, 'DESCENDING', -1);
rc=insertc(collist, 'name', -1);
call send(tabid, '_sort', collist, '/noduplicates');
rc=dellist(collist);


Chapter Contents

Previous

Next

Top of Page

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