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
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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