Previous Page | Next Page

Functions and CALL Routines

LENGTHC Function



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

Syntax
Arguments
Details
Comparisons
Examples
See Also

Syntax

LENGTHC(string)


Arguments

string

specifies a character constant, variable, or expression.


Details

The LENGTHC function returns the number of characters, both blanks and non-blanks, in string. 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, LENGTHC 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

The following SAS statements produce these results:

SAS Statements Results
x=lengthc('variable with trailing blanks   ');
put x;
32
length fixed $35;
fixed='variable with trailing blanks   ';
x=lengthc(fixed);
put x;


35


See Also

Functions:

LENGTH Function

LENGTHM Function

LENGTHN Function

Previous Page | Next Page | Top of Page