/ Published in: SAS
This code will help you to get the name of the computer you are running he code from.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/*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*/
URL: http://jaredprins.squarespace.com/blog/2008/3/31/sas-get-computer-name.html