Automatic macro variable!

Reply
Contributor
Posts: 66

Automatic macro variable!

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.

Super User
Posts: 5,424

Re: Automatic macro variable!

&SYSUSERID is the closest.

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

Data never sleeps
Super Contributor
Posts: 282

Re: Automatic macro variable!

Hi,

Are you looking for something like &sysuserid ?

Regards,

Amir.

Contributor
Posts: 66

Re: Automatic macro variable!

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

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

Thanks.

Super User
Super User
Posts: 7,942

Re: Automatic macro variable!

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.

Occasional Contributor
Posts: 15

Re: Automatic macro variable!

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

Ask a Question
Discussion stats
  • 5 replies
  • 313 views
  • 0 likes
  • 5 in conversation