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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 760 views
  • 0 likes
  • 3 in conversation