Previous Page | Next Page

Functions and CALL Routines

REVERSE Function



Reverses a character string.
Category: Character
Restriction: I18N Level 0
Tip: DBCS equivalent function is KREVERSE in SAS National Language Support (NLS): Reference Guide.

Syntax
Arguments
Details
Examples

Syntax

REVERSE(argument)


Arguments

argument

specifies a character constant, variable, or expression.


Details

In a DATA step, if the REVERSE function returns a value to a variable that has not previously been assigned a length, then that variable is given the length of the first argument.

The last character in the argument becomes the first character in the result, the next-to-last character in the argument becomes the second character in the result, and so on.

Note:   Trailing blanks in the argument become leading blanks in the result.  [cautionend]


Examples

SAS Statements Results

----+----1
backward=reverse('xyz  ');
put backward $5.;
 
  zyx

Previous Page | Next Page | Top of Page