Getting Started with SAS in UNIX Environments |
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.
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 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:
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.)
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
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)
sasv9.cfg in the !SASROOT directory. (See The !SASROOT Directory.)
sasv9_local.cfg in the !SASROOT directory. (See The !SASROOT Directory.)
.sasv9.cfg in your home directory. (Notice the leading period.)
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.
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. 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. For example, in the Korn shell, you would use:
export SASV9_CONFIG=filename
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.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.