Previous Page | Next Page

Functions and CALL Routines

LENGTHN Function



Returns the length of a character string, excluding trailing blanks.
Category: Character
Restriction: I18N Level 0

Syntax
Arguments
Details
Comparisons
Examples
See Also

Syntax

LENGTHN(string)


Arguments

string

specifies a character constant, variable, or expression.


Details

The LENGTHN function returns an integer that represents the position of the rightmost non-blank character in string. If the value of string is blank, LENGTHN returns a value of 0. If string is a numeric constant, variable, or expression (either initialized or uninitialized), SAS automatically converts the numeric value to a right-justified character string by using the BEST12. format. In this case, LENGTHN returns a value of 12 and writes a note in the SAS log stating that the numeric values have been converted to character values.


Comparisons


Examples

SAS Statements Results
len=lengthn('ABCDEF');
put len;


len2=lengthn(' ');
put len2;
 
6


 
0


See Also

Functions:

LENGTH Function

LENGTHC Function

LENGTHM Function

Previous Page | Next Page | Top of Page