CALL SORTC Routine

Sorts the values of character arguments.

Category:Sort
Interaction:When invoked by the %SYSCALL macro statement, CALL SORTC removes the quotation marks from its arguments. For more information, see Invoking CALL Routines and the %SYSCALL Macro Statement.
Note:Argument types for arguments that are updated must match in CALL routines. All argument types must be CHAR, VARCHAR, or NUMERIC. If the argument types do not match, a warning is issued to the log.

Syntax

CALL SORTC(variable-1 <, …, variable-n>);

Required Argument

variable

specifies a character variable.

Details

The values of variable are sorted in ascending order by the CALL SORTC routine.

Comparisons

The CALL SORTC routine is used with character variables, and the CALL SORTN routine is used with numeric variables.

Example

This example sorts the character variables in the array in ascending order.

data _null_;
   array x(8) $10
      ('tweedledum' 'tweedledee' 'baboon' 'baby'
       'humpty' 'dumpty' 'banana' 'babylon');
   call sortc(of x(*));
   put +3 x(*);
run; 

SAS writes the following results to the log:

baboon baby babylon banana dumpty humpty tweedledee tweedledum

See Also

Last updated: April 14, 2026