Desktop productivity for business analysts and programmers

Detecting who the Metadata User is in Submitted Code

Reply
Regular Contributor
Posts: 150

Detecting who the Metadata User is in Submitted Code

Is there an analog to the _metauser or _metaname macro variables that are available in Stored Processes that can be referenced in code submitted in EG directly to the current Workspace Server session? When I asked about this several years ago for 9.1.3, I was told that those macro variables would be available in 9.2 across all clients (e.g., EG, AMO, etc.). But I don't see them in EG 4.2.

Note that I need to know the identify of the metadata user, not the clientid (which is the id on the PC where EG is running).
Community Manager
Posts: 2,889

Re: Detecting who the Metadata User is in Submitted Code

Don,

I checked with our internal expert, and here is what he came up with.

In a *standard* workspace server, this works:

%let username = %scan(%sysget(METAUSER),1,'@');

Except on z/OS, where there are no environment variables, and *pooled* workspace servers and stored process servers, which are multi-user in nature:

%let username = %scan(%sysfunc(getoption(METAUSER)),1,'@');

Note that on Windows servers, the ID you get is not domain-qualified. That is, you would see "donh", not "HCBI\donh".

Chris
Regular Contributor
Posts: 150

Re: Detecting who the Metadata User is in Submitted Code

Thanks Chris. That seems to work quite nicely. I plan to package that into a macro that I already have that I use to convert &_metauser into a valid sas name. Once I do that I will post it on sasCommunity.org.
Contributor
Posts: 55

Re: Detecting who the Metadata User is in Submitted Code

Thanks for the code Chris. Would it be possible to get the user display name as well as the user ID?
Ask a Question
Discussion stats
  • 3 replies
  • 181 views
  • 0 likes
  • 3 in conversation