Chapter Contents

Previous

Next
Data Set Model: _sort

Data Set 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(s)>;

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 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(s)
C specifies 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. You may specify as many sort option strings as you like. 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

If you modify the current row in the table, you must use the _updateRow method before calling the _sort method.

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 SAS 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

In the following example, the Data Set Model class is being used as a stand-alone model, that is, the model class is not being used with a data form or data table object.

 Note about code
INIT:
  dcl list collist={'sex', 'descending', 'name'};
  datcl=loadclass('sashelp.fsp.datast_m.class');
  datid=instance(datcl);
 Note about code
  call send(datid, '_setDataset',
            'sasuser.class', 'edit');
 Note about code
  call send(datid, '_sort', collist, '/noduplicates');
return;
 Note about code
TERM:
   call send(datid,'_term');
 return;


Chapter Contents

Previous

Next

Top of Page

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