LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 11 Jun 2004 13:00:00 GMT
Reply-To:   Andre Wajda <Andre.Wajda@SHAW.CA>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Andre Wajda <Andre.Wajda@SHAW.CA>
Organization:   Shaw Residential Internet
Subject:   Re: Grabbing a DNS or hostname via a macro on Unix
Content-Type:   text/plain; charset=us-ascii; format=flowed

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!


Back to: Top of message | Previous page | Main SAS-L page