Configuring a SAS Session for Your Application

Introduction

There are several ways to set up a SAS session to accommodate the needs of the applications you want to deploy. Some applications will be called by users from within a SAS session, which requires that those users have access to the libraries that contain the data sets and catalogs that comprise the application. Other applications may extend or add additional capabilities to existing applications, and you can add program calls from one application to start another.
However, most applications that you deploy, require that you provide a custom invocation of SAS. To start a SAS session, you must have access to the SAS executable file and to a SAS configuration file. (A standard SAS configuration file is supplied with SAS software and is typically located in the same directory as the SAS executable file.) The SAS configuration file specifies
  • the value of an environment variable, SASROOT, that contains the name of the directory where SAS software is installed. The SAS executable and configuration files are stored in this directory.
  • which subdirectories of the SASROOT directory to search for various SAS products.
  • the location of the files that contain warning and error messages.
  • the location of the SAS help facility and other modules that are necessary for interactive execution (the SASHELP libref).
  • the location of a temporary directory for users' work files (the WORK libref).
  • the location of a permanent directory for users' personal files (the SASUSER libref).
  • the locations of online Help (HELPLOC) files.
  • the settings of other system options, some of which are host-specific.

Specifying a Custom Configuration File

The CONFIG system option specifies the location of the configuration file. You can include SAS system options as part of the SAS command that is used to start a SAS session. The configuration file that is supplied with Version 9 is called SASV9.CFG. Here are two examples, one for a PC environment and the other for UNIX operating environments:
sas -config c:\myApp\myConfigFile.cfg
sas -config /u/myApp/myConfigFile.cfg
Note: Your configuration file does not have to be named SASV9.CFG. If you use a generic name for your configuration file, start with a copy of the one that is supplied by SAS and then rename it. If you do not specify a configuration file in the SAS command, the first file named SASV9.CFG in a predefined search path is used. For details about host-specific system options and configuration files, see the SAS Companion for your operating environment.
To create a configuration file, you can
  1. Make a copy of the default configuration file.
  2. Modify the copy by adding or changing SAS system options.
You can also specify additional windowing environment options in a custom configuration file. For example, consider this configuration file for an application on a Windows PC:
-AWSCONTROL TITLE NOSYSTEMMENU MINMAX
-AWSTITLE 'Corporate Reporting'
-NOAWSMENUMERGE
-SASCONTROL NOSYSTEMMENU NOMINMAX
-NOSPLASH
-SET corprept F:\apps
-HELPLOC ('!sasroot\core\help'  'F:\apps\help')
-SPLASHLOC F:\apps\images
-INITCMD "AF C=corprept.APP.MAINMENU.FRAME PMENU=YES"
where
AWSCONTROL
specifies application workspace (AWS) features. Precede a feature with NO to disable it.
  • TITLE indicates whether the AWS includes a title bar.
  • SYSTEMMENU indicates whether the AWS menu appears.
  • MINMAX indicates whether the minimize and maximize controls appear.
AWSTITLE
specifies the title for the AWS window if the AWSCONTROL TITLE option is set.
AWSMENUMERGE/NOAWSMENUMERGE
specifies whether the AWS menu items Options, Window, and Help appear.
SASCONTROL
specifies application window features. Precede a feature with NO to disable it.
  • SYSTEMMENU indicates whether the AWS menu appears.
  • MINMAX indicates whether the minimize and maximize controls appear.
SPLASH/NOSPLASH
specifies whether the SAS software splash screen appears while your application is starting. You can substitute your own bitmap image for the SAS software splash screen. For more information, see the SAS Companion for the Microsoft Windows Environment.
SET
creates an environment variable. An environment variable that contains a pathname can be used as a SAS libref. For networked applications, ensure that all SAS files in this path have a read-only attribute.
HELPLOC
specifies the location of online Help files.
SPLASHLOC
specifies the location of a custom splash screen image to display when SAS starts.

Invoking Applications

You can use the INITCMD system option to launch your SAS/AF software application. The main advantage of this option is that SAS display manager windows are not displayed before your primary application window appears. You can add the INITCMD option to
  • the SAS command that you use to invoke the SAS session for your application
  • the configuration file that is used in conjunction with the SAS command.
The general form of the INITCMD system option is
-INITCMD "AF-command<,SAS-windowing-environment-command>; . . .;
SAS-windowing-environment-command"
The INITCMD option
  • is specified either as part of the SAS command or in a configuration file
  • requires you to specify the DMS option
  • must follow the -DMSEXP option (unless -NODMSEXP is specified) if placed in a configuration file
  • opens the AF window first
  • does not open other SAS windowing environment windows (but they can be opened by the application)
  • can issue additional SAS windowing environment commands
  • eliminates the need for the DM statement in an autoexec file and does not permit execution of DM statements
  • exits SAS when the user exits the application
  • is available in most operating environments.