Macros for SAS Application Developers
https://github.com/sasjs/core
mf_getuser.sas File Reference

Returns a userid according to session context. More...

Go to the source code of this file.

Detailed Description

In a workspace session, a user is generally represented by &sysuserid or SYS_COMPUTE_SESSION_OWNER if it exists. In a Stored Process session, &sysuserid resolves to a system account (default=sassrv) and instead there are several metadata username variables to choose from (_metauser, _metaperson ,_username, _secureusername). The OS account is represented by _secureusername whilst the metadata account is under _metaperson.

%let user= %mf_getUser();
%put &user;
Returns
SYSUSERID (if workspace server)
_METAPERSON (if stored process server)
SYS_COMPUTE_SESSION_OWNER (if Viya compute session)
Version
9.2
Author
Allan Bowe

Definition in file mf_getuser.sas.