SYSGET Function

Returns the value of the specified operating environment variable.

Category: Special
See: SYSGET Function: UNIX in SAS Companion for UNIX Environments
SYSGET Function: z/OS in SAS Companion for z/OS

Syntax

Required Argument

operating-environment-variable

is a character constant, variable, or expression with a value that is the name of an operating environment variable. The case of operating-environment-variable must agree with the case that is stored in the operating environment. Trailing blanks in the argument of SYSGET are significant. Use the TRIM function to remove them.

Operating Environment Information: The term operating-environment-variable used in the description of this function refers to a name that represents a numeric, character, or logical value in the operating environment. For more information, see the SAS documentation for your operating environment.

Details

If the SYSGET function returns a value to a variable that has not yet been assigned a length, by default the variable is assigned a length of 200.
If the value of the operating environment variable is truncated or the variable is not defined in the operating environment, SYSGET displays a warning message in the SAS log.

Example

This example obtains the value of two environment variables in the UNIX environment:
data _null_;
   length result $200;
   input env_var $;
   result=sysget(trim(env_var));
   put env_var= result=;
   datalines;
USER
PATH
;
Executing this DATA step for user ABCDEF displays these lines:
ENV_VAR=USER RESULT=abcdef
ENV_VAR=PATH RESULT=path-for-abcdef

See Also

Functions: