RIGHT Function

Right aligns a character expression.

Categories:Character
CAS
Restriction:This function is assigned an I18N Level 2 status, and is designed for use with SBCS, DBCS, and MBCS (UTF8). For more information, see Internationalization Compatibility.
Note:This function supports the VARCHAR type.
Tip:DBCS equivalent function is KRIGHT.

Syntax

RIGHT(argument)

Required Argument

argument

specifies a character constant, variable, or expression.

Details

In a DATA step, if the RIGHT 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 RIGHT function returns an argument with trailing blanks moved to the start of the value. The length of the result is the same as the length of the argument.

Example

The following SAS statements produce these results:
SAS Statement
Result
 
----+----1----+
a='Due Date  ';
b=right(a);
put a $10.;
put b $10.;
 
Due Date
  Due Date
Last updated: March 16, 2017