|
Not all systems have such a variable. Solaris 9 has env variable HOST
but Solaris 2.6 and 8 has none.
Andre Wajda
RolandRB wrote:
> If it is just the hostname you want then you do not need a macro as
> the value of it is assigned to a system environment variable called
> HOSTNAME, most likely. So you get it like this:
>
> %let hostname=%sysget(HOSTNAME);
>
> If that does not work then try listing out all your system environment
> variables and looking what is in them. That host name will be
> somewhere.
>
> env | more
>
> ...then use the name you found that contains it in the %sysget as
> above.
>
>
>
> kpkowitz@iwon.com (Kevin Kowitz) wrote in message news:<d521971f.0406100900.5663967b@posting.google.com>...
>
>>I wanted to be able to create the macro that just returns the hostname
>>from our unix system. To do this, I wrote the following Macro. The
>>problem is that the export statment is not happening or at least is
>>not happening before the sysget statement. Each time I run this, I
>>get a message saying that TMPXXXX variable does not exist.
>>
>>%MACRO UnixBox;
>> %sysexec(export TMPXXXX=`hostname`);
>> %let unixhost=%sysget(TMPXXXX);
>> &unixhost.
>>%MEND UnixBox;
>>
>>Any suggestions?
>>
>>(I know of several ways around this such as using a filename pipe
>>statement and several data steps but I wanted to be able to just
>>reference the macro in an if statement within a datastep.... ie. if
>>upcase("%UnixBox")='NAME' then do;....
>>
>>or within a SQL where clause... where upcase("%UnixBox")='NAME'.
>>
>>Using a filename pipe or an X command causes other problems that make
>>it difficult if not impossible to use the macro in the fashion that I
>>want to.)
>>
>>Thanks!
|