Revision: 5734
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
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; run; /*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
http://jaredprins.squarespace.com/blog/2008/3/31/sas-get-computer-name.html
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
SAS