Function: CALL SORTC
Function That Sorts Character Values
Purpose: To sort the values of its character arguments in ascending order
Syntax: CALL SORTC(<of> Char-1 <,
… Char-n>)
Char-n
is a character variable. If you use a variable list
in the form
Var1–Varn, precede
the list with the word "of"'.
Arguments
to the CALL SORTC routine cannot be constants. You may use
array references as
arguments to this routine as well (see the following examples):
Examples
For these examples, c1='bad',
c2='good', c3=' ', a1='b', a2='B', a3='a', and a4='A'.
Also, an array is defined as array
chars[3] c1-c3
Call Routine Return
CALL SORTC(of c1-c3) |
c1=' ', c2='bad', c3='good' |
Demonstrating
the CALL SORTC routine
***Primary
function: CALL SORTC;
data names;
input (Name1-Name5)(: $12.);
call sortc(of Name1-Name5);
datalines;
Charlie Able Hotel Golf Echo
Zemlachenko Cody Lane Lubsen Veneziale
bbb BBB aaa aaa ZZZ
;
title "Listing
of data set NAMES";
proc print data=names noobs;
run;
Output
NB:
on character values.
sensitive; the uppercase letters come before the lowercase letters in the collating sequence.
Comments
Post a Comment