Customizing Your SAS Session using Configuration and Autoexec Files


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 Chapter 3, "Customizing the SAS Windowing Environment," on page 53.

Introduction to Configuration and Autoexec Files

You can customize your SAS session by defining configuration and/or 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 data libraries. Refer to SAS Language Reference: Dictionary for a complete description of system options.)

The configuration file (for SAS 9.1) 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 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 SAS Configuration Files" on page 17.

Differences between Configuration and Autoexec Files

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

  • Configuration files can contain only SAS system option settings, while autoexec files can contain any valid SAS statement. For example, you might want to create an autoexec file that includes an OPTIONS statement to change the default values of various system options and LIBNAME and FILENAME statements for the SAS data libraries and external files that you use most often.

  • Configuration files are processed before SAS initializes, while autoexec files are processed immediately after SAS initializes but before it processes any source statements. An OPTIONS statement in an autoexec file is equivalent to submitting an OPTIONS statement as the first statement of your SAS session.

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 SAS Configuration Files" on page 17 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 - except 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. Close the configuration file.

Order of Precedence for SAS Configuration Files

SAS is shipped with a default configuration file in the !SASROOT directory. Your SAS Installation Representative 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: [2]

  1. sasv9.cfg in the !SASROOT directory. (See Appendix 1, "The !SASROOT Directory," on page 397.)

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

  3. sasv9.cfg in your home directory.

  4. sasv9.cfg in your current directory.

  5. 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 SAS System Configuration Guide for UNIX .

SAS uses the last value it encounters for a system option. 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 SAS Configuration Files" on page 17.

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.

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

  • specify a configuration file with the CONFIG system option in the SAS command:

     sas -config  filename  
  • specify a configuration file in the SASV9_OPTIONS environment variable. See "Defining Environment Variables in UNIX Environments" on page 21. For example, in the Korn shell, you would use:

     export SASV9_OPTIONS='-config  filename  ' 
  • define the environment variable SASV9_CONFIG. See "Defining Environment Variables in UNIX Environments" on page 21. For example, in the Korn shell, you would use:

     export SASV9_CONFIG=  filename  

filename is the name of a file containing 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.

[2] For future versions of SAS, the names of these files will change accordingly .




SAS 9.1 Companion for UNIX Environments
SAS 9.1 Companion For Unix Enivronments
ISBN: 1590472101
EAN: 2147483647
Year: 2004
Pages: 185
Authors: SAS Institute

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net