Previous Page | Next Page

Getting Started with SAS in UNIX Environments

Customizing Your SAS Session by Using Configuration and Autoexec Files


Customizing Your SAS Session

You can customize your SAS environment in several ways. To customize your SAS environment at the point of invocation, you can use configuration and autoexec files. For information about how to customize a SAS session using the windowing environment, see Customizing the SAS Windowing Environment.


Introduction to Configuration and Autoexec Files

You can customize your SAS session by defining configuration and autoexec files. You can use these files to specify system options and to execute SAS statements automatically whenever you start a SAS session. (SAS system options control many aspects of your SAS session, including output destinations, the efficiency of program execution, and the attributes of SAS files and libraries. Refer to SAS Language Reference: Dictionary for a complete description of SAS system options.)

The configuration file (for SAS 9.2) is typically named sasv9.cfg, and the autoexec file is named autoexec.sas. These files typically reside in the directory where SAS was installed. By default, this directory is the !SASROOT directory.

You can have customized configuration and autoexec files in your user home directory. If you do, then SAS will use the customizations specified in these files when you start a SAS session. For more information about the order of precedence SAS uses when processing configuration files, see Order of Precedence for Processing SAS Configuration Files.

SAS system options can be restricted by a UNIX system administrator, so that once they are set by the administrator, they cannot be changed by a user. A system option can be restricted globally, by group, and by user. For more information, see the configuration guide for the UNIX environment on support.sas.com, and see Restricted Options in SAS Language Reference: Dictionary.


Differences between Configuration and Autoexec Files

The differences between configuration files and autoexec files are as follows:


Creating a Configuration File

To create a configuration file, follow these steps:

  1. Use a text editor to write the SAS system options into a UNIX file. Save the file as either sasv9.cfg or .sasv9.cfg. (See Order of Precedence for Processing SAS Configuration Files for more information.)

  2. Specify one or more system options on each line. Use the same syntax that you would use for specifying system options with the SAS command, but do not include the SAS command itself. For example, a configuration file might contain the following lines:

    -nocenter
    -verbose
    -linesize 64
    -work /users/myid/tmp

  3. Save and close the configuration file.


Order of Precedence for Processing SAS Configuration Files

SAS is shipped with a default configuration file in the !SASROOT directory. Your on-site SAS personnel can edit this configuration file so that it contains whichever options are appropriate to your site.

You can also create one or more of your own configuration files. SAS reads option settings from each of these files in the following order:(footnote 1)

  1. sasv9.cfg in the !SASROOT directory. (See The !SASROOT Directory.)

  2. sasv9_local.cfg in the !SASROOT directory. (See The !SASROOT Directory.)

  3. .sasv9.cfg in your home directory. (Notice the leading period.)

  4. sasv9.cfg in your home directory.

  5. sasv9.cfg in your current directory.

  6. any restricted configuration files. Restricted configuration files contain system options that are set by the site administrator and cannot be changed by the user. Options can be restricted globally, by group, or by user. For more information about restricted configuration files, see the configuration guide for the UNIX environment.

For each system option, SAS uses the last setting it encounters; any other settings are ignored. For example, if the WORKPERMS system option is specified in sasv9.cfg in the !SASROOT directory and in sasv9.cfg in your current directory, SAS will use the value specified in sasv9.cfg in your current directory.


Specifying a Configuration File for SAS to Use

When you specify a configuration file for SAS to use, you bypass the search of the configuration files listed in Order of Precedence for Processing SAS Configuration Files.

Note:   SAS still processes any restricted configuration files that exist. The settings in these files take precedence over the settings in the configuration file that you specify.  [cautionend]

To specify a configuration file, complete one of the following steps:

filename is the name of a file that contains SAS system options.

If you have specified a configuration file in the SASV9_OPTIONS or SASV9_CONFIG environment variables, you can prevent SAS from using that file by specifying NOCONFIG in the SAS command.

If SAS cannot find SASV9_OPTIONS, the following message is written to the SAS log:

ERROR: Cannot open [/fullpath/filename]: No such
       file or directory.


FOOTNOTE 1:   For future releases of SAS, the names of these files will change accordingly. [arrow]

Previous Page | Next Page | Top of Page