BookmarkSubscribeRSS Feed
DonH
Lapis Lazuli | Level 10
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).
3 REPLIES 3
ChrisHemedinger
Community Manager
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
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
DonH
Lapis Lazuli | Level 10
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.
Technolero
Pyrite | Level 9
Thanks for the code Chris. Would it be possible to get the user display name as well as the user ID?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1354 views
  • 0 likes
  • 3 in conversation