RANK Function
Returns the position of a character in the ASCII collating sequence.
| Category: | Character |
|---|---|
| Returned data type: | DOUBLE |
Table of Contents
Syntax
Required Argument
expression
specifies any valid expression that evaluates or can be coerced to a character string.
| Data type | CHAR, NCHAR, NVARCHAR, VARCHAR |
|---|---|
| See | DS2 Expressions in SAS DS2 Programmer’s Guide |
Details
The RANK function returns a whole number that represents the position of the character in the ASCII collating sequence. When more than one character is specified, the RANK function returns the position in the ASCII collating sequence for the first character.
'7F'x.)
The program is not portable because these characters are national
characters and they vary from country to country.Example
The following program illustrates the RANK function:
proc ds2;
data test(overwrite=yes);
dcl varchar x;
method run();
x=rank('A');
put x;
end;
enddata;
run;
quit;
SAS writes the following ASCII output to the log.
65
See Also
-
Functions: