At startup, SAS looks for a file called AUTOEXEC.SAS. If the file is found, then the SAS statements in the file will be processed. This is useful for setting global options and defining data libraries (libnames) at the beginning of a SAS session.

A typical AUTOEXEC.SAS might contain an options statement and several libname statements. For example:

libname project 'c:\project';
libname paul    'c:\paul';
libname formlib 'c:\formats';

options nocenter fmtsearch=(formlib project);

Note that AUTOEXEC.SAS is processed once, when the SAS application is started, and not every time SAS commands are submitted.

AUTOEXEC.SAS is not the best place for storing SAS macros. These should be kept in a SAS autocall library.

The best place to store AUTOEXEC.SAS is in the SAS root directory (usually C:\SAS).  If you are running SAS from a server, or want to use a name for the file other than AUTOEXEC.SAS, you can specify the location of AUTOEXEC.SAS in the SAS startup command. For example: