The code below makes a print to your log containing different information related to your current SAS-session.
The code is heavily inspired from this article.
/* The macro need to know if your running the program on a remote server. The default is that the program is running on a remote server. If that is the case, the macro gets some information from the remote server. */ %macro GetExecInfo(rsubmit=yes);
/* Removes the %put-statement below. Makes it possible to get a fine print in your log. */
options nosource;
/* The programname and path. */
%let SASProgram = %sysget(sas_execfilepath);
/* If your running SAS on a remote server your need to supply the remote SAS with information about the local program being executed.*/
%if %upcase(&RSubmit) = YES %then
%do;
%syslput SASProgram = &SASProgram;
%end;
%if %upcase(&RSubmit) = YES %then
%do;
rsubmit;
%end;
%macro GetInfo; /* AIX (UNIX) systems and probably other systems doesn't have the same environment variables as eg Windows servers. */
%if &sysscpl = AIX %then
%do;
%let ServerName = N/A;
/* It is possible to try the statements below to get the servername from an AIX-server. */
/* host = sysget('HOST');
- OR - filename h pipe 'hostname';
data _null_;
infile h;
input;
put _infile_;
run;
*/
%end;
%else
%do;
%let ServerName = %sysget(computername);
%end;
/* Inserts blank lines in the log. */
skip;
skip;
%put ******************************************************************;
%put * Program : &SASProgram (Revision: );
%put * Date : &sysday, &sysdate9;
%put * User : &sysuserid;
%put * Server : &ServerName;
%put * OS version : &sysscp (&sysscpl);
%put * SAS version : &sysvlong4;
%put ******************************************************************; skip;
skip;
%mend;
%GetInfo;
%if %upcase(&RSubmit) = YES %then
%do;
endrsubmit;
%end;
options source;
%mend;
%GetExecInfo(rsubmit=yes);