Getting Started under Windows |
Introduction to Files Used by SAS |
SAS uses many files while it is running; however, some of these files are especially important from a user's perspective. These files include the
SAS configuration files (SASVx.CFG by default, where x is the release number)
Work data library ("SAS Temporary Files" folder in your system's designated TEMP area)
SAS Configuration Files |
The SAS configuration file enables you to specify SAS system options that are used to establish your SAS session. These system options indicate, among other things, the location of your SAS Help and Documentation files as well as the location of message files and the pathnames to SAS executable files. The SAS configuration file is particularly important because it specifies the folders that are searched for the various components of SAS products. You must have at least one configuration file in order for SAS to initialize; you can have multiple configuration files that are all processed while your SAS session begins. For a list of system options that you can use in your SAS configuration file, see Summary of System Options for Windows. For more information about system options, see SAS System Options under Windows and SAS System Options in SAS Language Reference: Dictionary.
In previous releases of SAS, the default configuration file was stored in the !SASROOT folder. The !SASROOT folder is the folder in which you install SAS. Starting with SAS 9, SAS creates two default configuration files during installation. Both configuration files are named SASV9.CFG.
SAS stores one of these files in the !SASROOT folder and the other in the !sasroot\nls\language-code folder. The language-code is a two-letter language code that indicates the SAS default language.
The SASV9.CFG file that is located in the !SASROOT folder contains a CONFIG system option that specifies the location of the configuration file for the SAS default language. The default system options that are used to start SAS are specified in the !sasroot\nls\language-code\SASV9.CFG file. For example, if SAS is installed in the default folder and the default language is English, the SASV9.CFG file in the !SASROOT folder contains -config "c:\program files\SAS\SASFoundation\9.2\nls\en\sasv9.cfg".
SAS requires a configuration file, so you must use a SAS configuration file regardless of whether you are using interactive or batch mode.
SAS uses the default configuration file if you start SAS by double-clicking a registered SAS file type, such as .sas.
For more information about the !SASROOT folder, see SAS Default Folder Structure.
Any system option can be specified when you start SAS. It is often more convenient to place frequently used system options in a configuration file. The syntax for specifying system options in a SAS configuration file is discussed in Syntax for System Options in the SAS Invocation or SAS Configuration File.
You can edit the default configuration file to add to or change the system option settings, or you can create your own configuration file. Creating a Customized Configuration File discusses how to modify your configuration file.
Your configuration file is divided into two sections. The first section specifies system options that are not updated by the SAS Setup application. The second section is used by the setup application for updating information about where SAS software is installed. The sections are divided by the following warning:
WARNING: INSTALL Application edits below this line. User options should be added above this box comment. INSTALL Application maintains and modifies the following options; -SASAUTO, -SASHELP, -SASMSG -PATH, and -MAPS. It also maintains and modifies the following CONFIG variables with the -SET option; INSTALL, USAGE, LIBRARY, SAMPSIO, SAMPSRC, SASCBT, and SASEXT01-SASEXT50. It preserves all lines above the line containing 'DO NOT EDIT BELOW THIS LINE'.
The setup application deletes all data below this warning but does not affect the options that are specified above it. The SET system option defines the following SAS environment variables: SASROOT, SASEXT0, SASFOLDER, MYSASFILES, SASCFG, SASAUTOS, SAMPSIO, SAMPSRC, EISIMAGE, and INSTALL. The setup application appends the following system options below this warning: SASUSER, WORK, HELPLOC, DMSEXP, APPLETLOC, TEXTURELOC, RESOURCESLOC, JREOPTIONS, SASSCRIPT, SASHELP, MSG, and PATH.
The text editor that you choose to edit the configuration file is important to preserve some of the special character formatting in the file. The recommended method is to edit your configuration file by using a SAS text editor (such as the Enhanced Editor) and save it by using the Save As dialog box. If you do not use a SAS text editor, be sure to use another ASCII text editor (such as Windows Notepad). Do not use a specialized editor such as the WordPad application or Microsoft Word. Using such editors can insert carriage control characters into your configuration file or corrupt the characters that are there.
When you install SAS, a SASV9.CFG file is created in the !SASROOT\nls\language-code folder. The language-code is a two-letter language code for the SAS default language. You can specify your own file to act as the configuration file, thus overriding the default file, SASV9.CFG.
The filename that you choose must follow the file-naming conventions for the Windows operating environment. The file extension must be .CFG.
When you use your own configuration file instead of the default configuration file, you must add several required system options. For example, you must either use the SET system option to define the environment variable, !SASROOT, or define SASROOT as a Windows environment variable.
To ensure that all required system options are defined in your configuration file, copy the default file (!SASROOT\nls\language-code\SASV9.CFG) and modify the copy instead of creating your own file.
You can create a customized configuration file and name the file either SASV9.CFG or .SASV9.CFG in your Windows user profile folder. During SAS invocation, SAS looks for either of these files in the Windows user profile folder if the -CONFIG options are not specified. Under Windows Vista, the path for Windows user profile folder is c:\Users\user-ID\Documents\My SAS Files\9.2. In all other cases, the user profile folder is c:\Documents and Settings\ user-ID\My Documents\My SAS Files\9.2.
When you use a file that is located in a different folder or that has a different name as your default configuration file, you must tell SAS where to find the configuration file. Use the CONFIG system option to specify the location of this configuration file. For example, the Target field of the SAS Properties dialog box might contain
"c:\program files\SAS\SASFoundation\9.2\sas.exe -config c:\mysas\mysasconfig.CFG"
If SAS cannot find the configuration file, an error message is displayed, and SAS does not initialize.
For more information about the CONFIG system option, see Processing Options Specified by Additional CONFIG Options and CONFIG System Option: Windows.
When you invoke SAS, SAS automatically searches several locations for configuration options that can affect your SAS session. SAS looks in the following areas and processes them in this order:
This environment variable, if defined, must resolve to a valid configuration file. In a multi-user Windows system, this environment variable would most likely be defined as a system environment variable (instead of as a user environment variable) so that it is processed for all users on that system. Use the SAS_USER_CONFIG user environment variable to specify a user-specific configuration file.
In the SAS invocation command, you can specify one or more -CONFIG options with the names of the configuration files that you want to use. You must include a separate -CONFIG option for each file that you want to specify.
SAS looks for a file that is named SASVx.CFG (x is the SAS version number) in the folder that contains the SAS.EXE file only if you do not specify a -CONFIG option at SAS invocation. This configuration file contains only a CONFIG system option that specifies the configuration file for the SAS default language.
SAS looks for a file that is named .SASVx.CFG (x is the SAS version number) in the Windows user profile folder only if you do not specify a -CONFIG option at SAS invocation. Under Windows Vista and Windows Server 2008, the Windows user profile folder is c:\Users\user-ID\Documents\My SAS Files\9.2. In all other cases, the user profile folder is c:\Documents and Settings\ user-ID\My Documents\My SAS Files\9.2.
SAS looks for a file that is named SASVx.CFG (x is the SAS version number) in the Windows user profile folder only if you do not specify a -CONFIG option at SAS invocation. Under Windows Vista and Windows Server 2008, the Windows user profile folder is c:\Users\user-ID\Documents\My SAS Files\9.2. In all other cases, the user profile folder is c:\Documents and Settings\ user-ID\My Documents\My SAS Files\9.2.
SAS looks for a file that is named SASVx.CFG (x is the SAS version number) in the current folder only if you do not specify a -CONFIG option at SAS invocation.
This environment variable, if defined, must be a path to a valid SAS configuration file. In a multi-user Windows system, this environment variable would likely be defined as a user environment variable (instead of as a system environment variable) so that it is processed only for the current user on that system. Use the SAS_SYS_CONFIG system environment variable to specify a system-wide configuration file.
This environment variable, if defined, contains a string of option specifications for any other SAS system options that you want to process each time that you invoke SAS. For example, this environment variable might contain -obs 2m -sasinitialfolder c:\myfolder -linesize max.
You can specify additional system options in the command that you use to invoke SAS. These system options always override option values that are set within any of the configuration files.
If you start SAS from the Windows Start menu, the last configuration file to be processed is the one that is specified in the Start menu shortcut for SAS. The options that are specified in this configuration file override any options that have previously been processed. By default, the Start menu shortcut specifies -config !SASROOT\nls\language-code\SASVx.CFG
SAS uses the default configuration file if you start SAS by double-clicking on a registered SAS file type, such as .sas or .sas7bpgm.
Order of Processing for SAS Configuration Files
You can also specify additional -CONFIG options within any configuration file. When SAS encounters a -CONFIG option, SAS immediately processes the options in that named file and then returns to process the remainder of the current file. SAS options that are encountered later in the processing always override those options that are specified earlier. For example, if you specify -ICON in the file that is specified by the SAS_SYS_CONFIG environment variable, and then -NOICON in the file that is specified by the SAS_USER_CONFIG environment variable, the -NOICON option is used. Since the options that you specify in the SAS invocation command are always processed last, those option values will always override the option values that are specified in configuration files. Order of Processing for SAS Configuration Files illustrates the flow of the SAS configuration file processing.
For more information about the CONFIG system option, see CONFIG System Option: Windows.
SAS Autoexec File |
The SAS autoexec file contains SAS statements that are executed immediately after SAS initializes and before any user input is accepted. These SAS statements can be used to invoke SAS programs automatically, set up certain variables for use during your SAS session, or set system options.
Use a SAS text editor to create your autoexec file. The text editor that you choose to create the autoexec file is important. The recommended method is to create the file by using a SAS text editor (such as the Enhanced Editor window) and save it using the Save As dialog box. If you do not use the SAS text editor, be sure to use another ASCII text editor (such as Windows Notepad). Do not use a specialized editor such as the WordPad application or Microsoft Word. Using such an editor can insert special carriage control characters into your autoexec file that SAS cannot interpret when it tries to execute the statements in the file.
Unlike the configuration file, a SAS autoexec file is not required in order to run SAS. But, if you do have an autoexec file, the default name is AUTOEXEC.SAS. SAS uses the following search order to find the AUTOEXEC.SAS file:
Note: For information on determining the current folder, see: Determining the Current Folder When SAS Starts.
Search the paths that are specified by the Windows PATH environment variable.
You do not have to name your autoexec file AUTOEXEC.SAS, but if you name it something else, you must use the AUTOEXEC system option to tell SAS where to find the autoexec file. For example, you can specify the following option after the path specification for the SAS.EXE file in the Target field of the SAS Windows shortcut:
-autoexec c:\mysasfiles\init.sas
If the specified autoexec file is not found, an error message is displayed, and SAS terminates.
The autoexec file is a convenient way to execute a standard set of SAS program statements each time that you invoke SAS. You can include OPTIONS, LIBNAME, or FILENAME statements, or any other SAS statements and system options that you want the system to execute each time you invoke a SAS session. For example, if you want to specify a script file for SAS/CONNECT software, you can place the following statement in the AUTOEXEC.SAS file:
filename rlink 'c:\program files\SAS\SASFoundation\9.2\connect\saslink\ startSession.scr';
Or you can use the OPTIONS statement to set the page size and line size for your SAS output and use several FILENAME statements to set up filerefs for commonly accessed network drives, as in the following example:
options linesize=80 pagesize=60; filename saledata 'f:\qtr1'; filename custdata 'l:\newcust'; filename invoice 'o:\billing';
Other system options, in addition to the AUTOEXEC system option, provide ways to send SAS information as it is initializing. These options are listed below in the order in which they are processed:
For more information about the CONFIG, AUTOEXEC, INITSTMT, and SYSIN system options, see SAS System Options under Windows. For more information about the INITCMD system option, see SAS Language Reference: Dictionary.
If you have an AUTOEXEC.SAS file in your current folder, but you want to suppress it, specify the NOAUTOEXEC option in the SAS command, as in the following example:
c:\program files\SAS\SASFoundation\9.2\sas.exe -noautoexec
Profile Catalog |
Each time that you invoke a SAS session, SAS checks the Sasuser data library for your user Profile catalog (named Sasuser.Profile), which defines the start-up profile for your SAS session, including key definitions, display configurations, and other personal customizations. If you invoke SAS without accessing an existing Profile catalog, SAS creates one with the default key definitions and window configuration.
If Sasuser.Profile does not exist and Sashelp.Profile (in the Sashelp data library) does exist, SAS copies Sashelp.Profile to Sasuser.Profile before invoking a SAS session.
The Profile catalog is not re-created if it already exists. Any customizations (such as key definitions or color modifications) that are defined during subsequent sessions are stored in your Profile catalog in the specified folder.
The default configuration file for SAS specifies the SASUSER system option as follows:
Windows Vista | Windows XP, and Windows Server 2003 |
---|---|
-sasuser "c:\Users\user-ID\Documents\My SAS Files\9.2" | -sasuser "c:\Documents and Settings\user-ID\My Documents\My SAS Files\9.2" |
Use the SASUSER system option to specify a location for the Profile catalog other than the default (which is a folder named \My SAS Files\9.2). This option is useful if you want to customize your SAS sessions when sharing a machine with other users or if users are accessing SAS from a network.
The SASUSER system option takes the following form:
-SASUSER ("library-specification") |
Parentheses () are used to specify multiple library-specifications, and quotes (") are used when special characters and spaces are used in the library-specification.
If library-specification (which specifies a valid Windows pathname) does not exist, SAS attempts to create it. For example, if you specify the following option, a Profile catalog is created in a folder named MYUSER that resides in the root folder of the C: drive:
-sasuser "c:\myuser"
For more information, see SASUSER System Option: Windows.
When you delete your Profile catalog, you lose the key definitions, window configurations, and option settings that you might have defined, as well as any other entries that you saved to your Profile catalog. In addition, any text that you stored in NOTEPAD windows is erased. For this reason, it is a good idea to make a backup copy of your Profile catalog after making significant modifications to your SAS session settings.
Work Data Library |
SAS requires some temporary disk space during a SAS session. This temporary disk space is called the Work data library. By default, SAS stores SAS files with one-level names in the Work data library, and these files are deleted when you end your SAS session. You can change the Work data library in which SAS files that have one-level names are stored. For more information, see Using the User Libref.
The default configuration file for SAS specifies the WORK system option to be a folder in your system's designated temporary area (as defined by the TEMP environment variable). For example: !TEMP\SAS Temporary Files .
To determine TEMP environment variable, refer to the System Properties dialog box that you access from the Control Panel.
For more information about using the Work data library and overriding the default location, see Using the Work Data Library.
The WORK system option controls the location of the Work data library. You can specify the WORK option in your SAS configuration file or when you invoke SAS. Usually, you use the WORK option that is specified in the default configuration file.
Because you can run multiple SAS sessions at one time, SAS creates temporary subfolders under the folder that you specify with the WORK option. These temporary subfolders are created in the unique form _TDnnnnnnnnnn, where TD means temporary folder and nnnnnnnnnn is the process ID for each SAS session. These subfolders enable multiple SAS sessions to be invoked, each using the same configuration file, and they prevent the Work folder from being shared. SAS creates any temporary files that are required within each temporary folder. As with all temporary files that are created in the Work data library during a SAS session, these temporary folders are deleted when you end the SAS session. If SAS terminates abnormally, you might need to delete the temporary files.
If SAS terminates abnormally, determine whether the Work library was deleted. If not, remove it by using Windows commands.
Note: Do not attempt to delete the Work folder while SAS is running.
You can verify the location of the current Work folder by opening the Libraries folder in the SAS Explorer window. Click the right mouse button on the Work folder and select Properties from the pop-up menu.
SAS Registry Files |
The SAS registry files are used to store information about the SAS session applications. The registry entries can be customized by using the SAS registry editor or by importing the registry files. To invoke the SAS registry editor, select Solutions Accessories Registry Editor.
Registry customization is generally performed by more advanced users who have experience and knowledge of SAS and their operating environment.
SAS Default Folder Structure |
The SAS Setup program creates a number of subfolders during the installation process. Understanding the organization of the SAS folders can help you to use SAS more efficiently.
The root folder of SAS is the folder in which you install SAS. Within SAS, this folder has the logical name !SASROOT. If you use the default provided by SAS, this folder is c:\Program Files\SAS\SASFoundation\9.2. (The examples in this document assume the !SASROOT folder is called c:\Program Files\SAS\SASFoundation\9.2.)
SAS creates a folder for shared components, such as the Enhanced Editor and images, that are used by other SAS products. For SAS 8, the default path for shared components is c:\Program Files\SAS Institute\Shared Files. For SAS 9 and 9.2, the default path for shared files, if shared components are installed, is c:\Program Files\SAS\Shared Files. If shared components are not installed, the default path is c:\Program Files\SAS\SharedFiles. There is no blank space in the spelling of SharedFiles.
One important subfolder of the !SASROOT folder is the CORE subfolder. The CORE subfolder contains many subfolders, three of which are described here:
For each SAS product that is installed, the following subfolders might be created (not all products contain all of these folders):
contains miscellaneous external files shipped with the product.
Some products, such as SAS/CONNECT software, also have other subfolders that are associated with them. For details about each product's structure, see the specific SAS product documentation.
For more information about how the SAS folders are configured at your site, contact your on-site SAS support personnel.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.