Return to Snippet

Revision: 5734
at March 31, 2008 13:27 by webonomic

Initial Code
/*Method 1*/
%let cname = “%sysget(computername)”;  

/*Method 2*/
filename getinfo PIPE “hostname” ;
data _null_ ;
infile getinfo ;
input ;
put _infile_ ;
run ;

/*this works because 'hostname' is a command whereas trying to use 'computername' will not work because it is a system variable*/

/*Method 3*/
filename getcmd pipe ‘net config workstation’;
data theds(keep=theline);
length theline $200;
infile getcmd length=lenvar;
input @1 theline $varying. lenvar;
/*then parse out pieces you want*/

/*Method 4*/
%Put computername<%sysget(computername)>;
/*again, parse out what you need*/

/*All of the above ones may work on Unix/Linux with the exception of Method 4*/

Initial URL

Initial Description
This code will help you to get the name of the computer you are running he code from.

Initial Title
Get Computer Name

Initial Tags

Initial Language