Previous Page | Next Page

Getting Started with SAS under OpenVMS

Autoexec Files


What Is an Autoexec File?

Unlike configuration files, which can contain only SAS system options, an autoexec file can contain valid SAS statements. Autoexec files are processed immediately after SAS initializes, but before it processes any source statements.

For example, an autoexec file could contain the following lines:

options fullstimer linesize=75;
libname mylib 'dev:[homedir.subdir]';
dm 'wait 0';

In this example, the OPTIONS statement sets some SAS system options, the LIBNAME statement assigns a libref, and the DM statement executes a SAS windowing environment command.

Note:   Some SAS system options can be specified only when you invoke SAS. These system options cannot be specified in an OPTIONS statement; therefore, they cannot be specified in an autoexec file. Summary of SAS System Options under OpenVMS tells where each SAS system option can be specified.  [cautionend]


Difference between Autoexec and Configuration Files

Because autoexec files are processed after SAS is initialized, setting the NODATE and LINESIZE= options in a configuration file affects the appearance of the SAS log header, whereas setting NODATE and LINESIZE= in an autoexec file does not. An OPTIONS statement in an autoexec file is equivalent to submitting an OPTIONS statement as the first statement of your SAS session.


Five Types of Autoexec Files

Under OpenVMS, the OpenVMS logical name SAS$INIT is used to refer to SAS autoexec files. This logical name can exist in one or more of the process-, job-, group-, system-, or cluster-level logical name tables. Therefore, five types of autoexec files can be created:

Ask your system manager which of these autoexec files are used at your site.

Steps for Creating an Autoexec File

To create an autoexec file, follow these steps:

  1. Use any text editor to write SAS statements into an OpenVMS file. Use .SAS as the file extension.

  2. Type in the SAS statements that you want to include.

  3. Close the new autoexec file.

  4. Create the logical name SAS$INIT in the appropriate logical name table. For example, the following DCL DEFINE command creates the logical name SAS$INIT in the process-level logical name table:

    $ DEFINE SAS$INIT-
    _$ DISK:[DIRECTORY]MYEXEC.SAS

    For more information about creating logical names, see OpenVMS User's Manual.


Specifying an Autoexec File

If you have created the OpenVMS logical name SAS$INIT, then SAS automatically executes the statements in the autoexec file that is associated with that logical name. If SAS$INIT exists in more than one logical name table, then SAS executes the autoexec files in the order in which they are listed in Precedence for System Option Specifications.

Alternatively, you can use the AUTOEXEC= system option in the SAS command to tell SAS where to find your autoexec file. For example, the following SAS command invokes SAS and tells it to execute the autoexec file MYEXEC.SAS:

$ SAS92/AUTOEXEC=DISK:[DIRECTORY]MYEXEC.SAS

If you are specifying a DECnet location for an autoexec file while you are using a proxy OpenVMS account, then you need to use the following syntax. This example uses the SAS$INIT logical name with the AUTOEXEC= system option:

$ DEFINE MYAUTO node """useid""::DISK:[DIRECTORY]AUTOEXEC.SAS
$ SAS92/AUTOEXEC=MYAUTO

Note:   Check to make sure you have the correct number of quotation marks surrounding useid. If you have the incorrect number of quotation marks, then an error will appear in the log when you are using interactive or batch modes.  [cautionend]


Displaying Autoexec Statements in the SAS Log

SAS statements that are submitted from an autoexec file usually are not displayed in the SAS log. However, if the ECHOAUTO system option when you invoke SAS, then SAS writes (or echoes) the autoexec statements to the SAS log as they are executed. For example, suppose your autoexec file is MYEXEC.SAS and that it contains the following SAS statements:

options fullstimer linesize=75;
libname mylib 'dev:[homedir.subdir]';
dm 'wait 0';

If you use the following command to invoke SAS, then the contents of MYEXEC.SAS will be written to the SAS log:

$ SAS92/AUTOEXEC=MYEXEC.SAS/ECHOAUTO

For more information about the ECHOAUTO system option, see SAS Language Reference: Dictionary.

Previous Page | Next Page | Top of Page