sassas-metadatasas-stored-process

Determining Server Context (Workspace Server vs Stored Process Server)


I'd like to conditionally execute code depending on whether I'm in a Workspace or Stored Process server context.

I could do this by testing the existence of an automatic STP variable, eg _metaperson, but this wouldn't be very robust.

Assuming I already have a metadata connection, how best to check my server type?


Solution

  • Hurrah - there is, in fact, an automatic variable that does just this - sysprocessmode (available since 9.4)

    Extract from documentation:

    SYSPROCESSMODE is a read-only automatic macro variable, which contains the name of the current SAS session run mode or server type, such as the following:

    • SAS DMS Session
    • SAS Batch Mode
    • SAS Line Mode
    • SAS/CONNECT Session
    • SAS Share Server
    • SAS IntrNet Server
    • SAS Workspace Server
    • SAS Pooled Workspace Server
    • SAS Stored Process Server
    • SAS OLAP Server
    • SAS Table Server
    • SAS Metadata Server

    Being an automatic variable, it is of course read only: enter image description here