Previous Page | Next Page

SAS Component Language Dictionary

MLENGTH



Returns the maximum length of a variable
Category: Character

Syntax
Details
Example
See Also

Syntax

length=MLENGTH(var);

length

contains the maximum length of a variable.

Type: Numeric

var

is the variable whose maximum length you want to determine.

Type: Character


Details

MLENGTH is different from LENGTH, which returns the trimmed length. For window variables, MLENGTH returns the length of the variable in the display.

If a numeric variable is passed to MLENGTH, MLENGTH always returns a length of 8 for the variable. For non-window variables, MLENGTH returns the declared length of the variable.


Example

In this example, MLENGTH returns the value 5, which is the declared length of variable S. However, LENGTH returns the value 2, because S contains ab .

length s $ 5;
s='ab';
l=length(s);
m=mlength(s);


See Also

LENGTH

Previous Page | Next Page | Top of Page