%SYSGET Function

Returns the value of the specified operating environment variable.
Type: Macro function

Syntax

%SYSGET(environment-variable)

Required Argument

environment-variable
is the name of an environment variable. The case of environment-variable must agree with the case that is stored on the operating environment.

Details

The %SYSGET function returns the value as a character string. If the value is truncated or the variable is not defined on the operating environment, %SYSGET displays a warning message in the SAS log.
You can use the value returned by %SYSGET as a condition for determining further action to take or parts of a SAS program to execute. For example, your program can restrict certain processing or issue commands that are specific to a user.
For details, see the SAS documentation for your operating environment.

Example: Using SYSGET in a UNIX Operating Environment

This example returns the ID of a user on a UNIX operating environment:
%let person=%sysget(USER);
%put User is &person;
When these statements execute for user ABCDEF, the following is written to the SAS log:
User is abcdef