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-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!

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.

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