LEFT Function

Left-aligns a character string.

Category: Character
Restriction: I18N Level 0 functions are designed for use with Single Byte Character Sets (SBCS) only.
Tip: DBCS equivalent function is KLEFT. See DBCS Compatibility.

Syntax

LEFT(argument)

Required Argument

argument

specifies a character constant, variable, or expression.

Details

The Basics

In a DATA step, if the LEFT function returns a value to a variable that has not previously been assigned a length, then that variable is given the length of the argument.
LEFT returns an argument with leading blanks moved to the end of the value. The argument's length does not change.

DBCS Compatibility

The LEFT function left-aligns a character string. You can use the LEFT function in most cases. If an application can be executed in an ASCII environment, or if the application does not manipulate character strings, then using the LEFT function rather than the KLEFT function.

Example

The following SAS statements produce these results.
SAS Statement
Result
----+----1----+
a='  DUE DATE';
b=left(a);
put b;
 
DUE DATE