Chapter Contents

Previous

Next
MLENGTH

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


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.