ENVLEN Function

Returns the length of an environment variable.

Category: SAS File I/O

Syntax

ENVLEN(argument)

Required Argument

argument

specifies a character variable that is the name of an operating system environment variable. Enclose argument in quotation marks.

Details

The ENVLEN function returns the length of the value of an operating system environment variable. If the environment variable does not exist, SAS returns –1.
Operating Environment Information: The value of argument is specific to your operating environment.

Example

The following examples are for illustration purposes only. The actual value that is returned depends on where SAS is installed on your computer.
SAS Statement
Result
   /* Windows operating environment */
x=envlen("PATH");
put x;
309
   /* UNIX operating environment */
y=envlen("PATH");
put y;
365
z=envlen("THIS IS NOT DEFINED");
put z;
-1