sas %sysget() to retrieve hostname

  • Follow


is there an environment variable holding the hostname in unix (similar to computername in pc)

(also would appreciate if someone can provide code to printout list of environment variables - unix and pc)

I want to try these options before issuing unix commands to retrieve value. 

Many Thanks 
0
Reply Eversmann 3/1/2011 6:17:21 PM

HOST?
0
Reply data 3/1/2011 6:32:17 PM


On 1 mrt, 19:17, Eversmann <rifazraz...@gmail.com> wrote:
> is there an environment variable holding the hostname in unix (similar to computername in pc)
>
> (also would appreciate if someone can provide code to printout list of environment variables - unix and pc)
>
> I want to try these options before issuing unix commands to retrieve value.
>
> Many Thanks

The environment is largely dependent upon the shell being used (bash,
ksh, sh, csh, ...). Any additional info from you would be helpful
here. The most common variants ((k|ba|)sh) know HOSTNAME.
Alternatively you can try to pipe the output from the hostname command
into an infile:

filename h pipe 'hostname';
data _null_; infile h; input; put _infile_; run;

would echo the hostname to the log. In the datastep you can stick it
into a (macro) variable for onward use.

If you want to know all available variables:

filename h pipe 'set';
data _null_; infile h; input; put _infile_; run;

The availablitiy of the pipe option is dependent upon settings like
xcmd that may or may not be under your control.

This is by heart. I have not really tested this as I am at work in a
Windows environment. But I trust it is a direction you can investigate
further.

HTH Jan.
0
Reply jan.klaverstijn (1) 3/3/2011 8:49:18 AM

2 Replies
468 Views

(page loaded in 0.063 seconds)

Similiar Articles:













7/24/2012 7:19:24 AM


Reply: