SAS Component Language Dictionary |
Returns the maximum length of a variable
-
length
-
contains the maximum length of a
variable.
Type: Numeric
-
var
-
is the variable whose maximum length
you want to determine.
Type: Character
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.
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);
LENGTH
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.