BookmarkSubscribeRSS Feed
rnmishra
Calcite | Level 5

In EG,

The automatic macro variable   "_CLIENTUSERNAME" 

  Extracts user name of the user/client but does not work in base SAS.

Is there an equivalent  automatic macro variable in Base SAS that extracts the user name?

Thanks for you attention.

Raghu.

5 REPLIES 5
LinusH
Tourmaline | Level 20

&SYSUSERID is the closest.

Depending on your host OS, this information could be available thru OS commands/environment variables.

Data never sleeps
Amir
PROC Star

Hi,

Are you looking for something like &sysuserid ?

Regards,

Amir.

rnmishra
Calcite | Level 5

I would like to extract the user name not the user id.

Exactly what you get on EG when you run "&_CLIENTUSERNAME" .

Thanks.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Its really dependant on your setup.  If you have SAS locally installed then sysuserid will return the username it gets, probably Windows user login (I can't test this).  If you have it on a virtual system then it may be the login information for the virtual system.  We have ours on Citrix and that return the user information which is setup in the initiation files.

Depending on your setup and what you want to do, you would need to talk to your IT Helpdesk.  Principally, you need to be careful what you are doing with the information, but also your IT will be the ones who deal with login information.

If its just a matter of you want in your program and audit of who ran a program, then just setup a small dataset somewhere with user list and take it from there based on the sysuserid.

TonWiegman
Calcite | Level 5

Hi,

If you run (in SASBase):

%put _all_;

you get a list of available macro variables.


If you run x set;

you will be sent to a dos-box showing the environment variables.


You could apply the mechanism below to any of the environment variables:


%let username=%sysget(username);
%put username is: &username;
%let domainname=%sysget(userdomain);
%put domain name is: &domainname;


%put  &SYSUSERID;


Good luck.

Ton

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 10264 views
  • 0 likes
  • 5 in conversation