next up previous
Next: The .sasv9.cfg file Up: SAS on Unix Previous: Killing all sas processes:


The autoexec.sas file

The autoexec.sas file is a file in your home directory (Unix) or in C: (Windows). It contains SAS statements that are executed each time a SAS session is started. It is a useful place to keep library definitions, options statements, and %include statements for macro files that you use constantly.

A section of my autoexec file follows:

%sysexec(perl ~/utils/cleanworksas);
    
%include '~/utils/sasmacros/macrolist.sas';
options linesize=130;
options dtreset;
options mprint symbolgen msglevel=i;

proc options option=work;
run;

%put The PID of this SAS process is: &sysjobid;
The %sysexec statement launches a shell to execute the command given. Here it runs perl on my cleanworksas program, which cleans out old work directories from previous SAS sessions. You're unlikely to need this on WRDS, because this is done automatically there.

macrolist.sas contains all the macros I referred to in Section 10.3.

linesize sets the width of the page (80 is good for printing on A4 paper). options dtreset prints the current date and time anytime the date or time has to be written to the log or lst files, instead of the date and time the program started, which is the default.

The proc options statement prints the name of the work folder to the log. This is useful in case I want to look at the datasets in WORK while the program is running, or delete them manually if the program exits abnormally.

&sysjobid is a macro variable, automatically created by SAS, containing the Unix process ID of the current SAS job. This is a useful thing to have when you have three jobs with the same name running and you want to kill one, but aren't sure which is which.


next up previous
Next: The .sasv9.cfg file Up: SAS on Unix Previous: Killing all sas processes:
Andre de Souza 2012-11-19