Macro variables that provide information about your SAS® environment


ProblemSolversHave you ever needed to run code based on the client application that you are using? Or have you needed to know the version of SAS® software that you are running and the operating system that you are running it on? This blog post describes a few automatic macro variables that can help with gathering this information.

Application Name

You can use the &_CLIENTAPP macro variable to obtain the name of the client application. Here are some details:

  • Referencing &_CLIENTAPP in SAS® Studio returns a value of SAS Studio
  • Referencing &_CLIENTAPP in SAS® Enterprise Guide® returns a value of ‘SAS Enterprise Guide
    Note: The quotation marks around SAS Enterprise Guide are part of the value.

Program Name

You can use the &SYSPROCESSNAME macro variable to obtain the name of the current SAS process. Here are some details:

  • Referencing &SYSPROCESSNAME interactively within the DMS window returns a value of DMS Process
  • Referencing &SYSPROCESSNAME in the SAS windowing environment of your second SAS session returns a value of DMS Process (2)
  • Referencing &SYSPROCESSNAME in SAS Enterprise Guide or SAS Studio returns a value of Object Server
  • Referencing &SYSPROCESSNAME in batch returns the word Program followed by the name of the program being run (for example: Program 'c:\')
    Note: For information about other techniques for retrieving the program name, see SAS Note 24301: “How to retrieve the program name that is currently running in batch mode or interactively.”


The following code illustrates how you can use both of these macro variables to check which client application you are using and display a message in the SAS log based on that result:

%macro check;
  %if %symexist(_clientapp) %then %do;
   %if &_clientapp = SAS Studio %then %do;
    %put Running SAS Studio;
   %else %if &_clientapp= 'SAS Enterprise Guide' %then %do;
    %put Running SAS Enterprise Guide; 
  %else %if %index(&sysprocessname,DMS) %then %do;
    %put Running in Display Manager;
  %else %if %index(&sysprocessname,Program) %then %do;
     %let prog=%qscan(%superq(sysprocessname),2,%str( ));
     %put Running in batch and the program running is &prog;
  %mend check;

SAS Session Run Mode or Server Type

Another helpful SAS read-only automatic macro variable is &SYSPROCESSMODE. You can use &SYSPROCESSMODE to obtain the current SAS session run mode or server type name. Here is a list of possible values:

• SAS Batch Mode

• SAS/CONNECT Session 

• SAS DMS Session

• SAS IntrNet Server

• SAS Line Mode

• SAS Metadata Server

• SAS OLAP Server

• SAS Pooled Workspace Server

• SAS Share Server

• SAS Stored Process Server

• SAS Table Server

• SAS Workspace Server

Operating System and Version of SAS

Having the information detailed above is helpful, but you might also need to know the operating system and exact version of SAS that you are running. The following macro variables help with obtaining this information.

You can use &SYSSCP and &SYSSCPL to obtain an abbreviation of the name of your operating system.  Here are some examples:


For a complete list of values, see the “SYSSCP and SYSSCPL Automatic Macro Variables” section of SAS® 9.4 Macro Language: Reference, Fourth Edition.

SAS Release

&SYSVLONG4 is the most informative of the macro variables that provide SAS release information. You can use it to obtain the release number and maintenance level of SAS as well as a four-digit year. Here is an example:

%put &sysvlong4;

This code would print something similar to the following in the log:


Here is what this output means:

SAS release: 9.04.01

Maintenance level: M3

Ship Event date: D06292015

I hope that some of the tools described above are useful to you for obtaining information about your SAS environment. If you have any questions, please contact SAS Technical Support, and we will be happy to assist you. Thank you for using SAS!m


About Author

Russ Tyndall

SAS Technical Support Analyst

Russ Tyndall is a Senior Principal Technical Support Analyst in the Foundation SAS group in Technical Support. He has been a SAS user since 1993, and provides general support for the DATA step and Base procedures. He specializes in the SAS macro facility and has been the primary support for more than 18 years .


  1. Thanks for sharing, this is very informative.
    It seems that the _CLIENTAPP variable is initialized only once the _client_ session is started, not at the early stage of the _sas_ session (meaning, in technical terms, Scope >> Kernel, though the comparison with libref assignments is not perfect). This would mean that the %check macro you provide might not work properly if launched by the autoexec or even at INITSTMT level. The _CLIENTAPP variables are created down below at a further stage of the process when SAS Studio/SAS EG is eventually available.
    My tests with _CLIENTAPP date back to SAS 9.2 so I am not sure if the same applies to 9.3 & 9.4 ?

  2. Good post - thanks for the list of values for &sysprocessname.

    It would be good to explicitly state that the availability of these variables depends on the SAS version being used. Your macrco code implicitly recognizes this becase you use %symexist to test if &_clientapp variable is defined. All 3 of &_clientapp, &sysprocessname, &sysprocessmode are available in the version of SAS 9.4 running on our Linux servers, but &_clientapp is not available in the versions of PC SAS 9.4 that we are using. Some of the things discussed above are also available in some 9.3 versions.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Top