The AF and AFAPPLICATION Commands
The SAS/AF task, initiated with the AF or AFAPPLICATION (AFAPPL or AFA) command, establishes the execution environment for your SAS/AF application. Invoking your application as a task enables you to execute SAS statements, contained within SUBMIT blocks, while the application is running. The AF command opens the AF window and can be issued from a command line or the command box. The following AF command invokes the entry PRIMARY.FRAME in the catalog MYLIB.MYCATALOG:
af c=myLib.myCatalog.primary.frame |
The AFA command enables you to run multiple SAS/AF applications simultaneously. Each SAS/AF application executes as a separate task. Thus, while one application is still executing, you can invoke a second application by issuing an AFA command as follows:
afa c=myLib.myCatalog2.primary.frame |
For additional information on the AF and AFA commands, refer to the SAS/AF Procedure Guide in the SAS OnlineDoc.
Using the DM Statement
If you are writing the application for others to use, you can include the AF or AFA command in an autoexec file so the application can be invoked by either double-clicking on an icon or executing a host specific command file from the system prompt. Refer to the SAS documentation for your host system for details.
To issue an AF or AFA command from an autoexec, you need to include it in a DM statement. This statement, which requires the SAS display manager environment, enables you to submit SAS display manager commands, such as the AF or AFA commands, using a SAS statement. It also provides an option to define the AF window as the active window once the AF or AFA command has executed. For example, the following DM statement issues the AF command and defines the AF window as the active window.
dm 'af c=myLib.myCatalog.primary.frame' af; |
Although the DM statement requires the SAS display manager environment, you can bypass this windowing environment by closing the four primary windows. Any of these windows can be subsequently opened with their respective window call commands from within your SAS/AF application. In the DM statement that follows, we first close the Log, Output, and Output Manager windows, issue an AF command, and then close the Program Editor window. Because we need a window from which to issue the AF command, the Program Editor window is closed after the AF command has been issued.:
dm 'log off;listing off;manager off;af c=myLib.myCatalog.primary.frame; program off;' af; |
You may notice that executing a DM statement which leaves the AF window active produces a message, DM statement running, in any SAS window border. This can be prevented by replacing the AF window option in your DM statement with the CONTINUE option. For example, if you include the following SAS statements in an autoexec file, the SAS System will display the window of PRIMARY.FRAME in the catalog MYLIB.MYCATALOG, execute the DATA step, and finally activate the AF window:
dm 'af c=myLib.myCatalog.primary.frame' continue; data mylib.mydata; /* additional SAS statements */ run; |
To avoid having any SAS code which follows the DM statement execute prematurely, include those statements in a SUBMIT block in the TERM section of the final entry of your SAS/AF application. For additional information on the DM statement and the CONTINUE option, refer to the SAS Language Reference: Dictionary in the SAS OnlineDoc.
The INITCMD System Option
The INITCMD system option can be used to automatically invoke any fullscreen application such as a SAS/AF application. When using this option, the Program Editor, Log, and Output windows are suppressed. These windows can, however, be activated with their respective window call commands from within your SAS/AF application. When using the INITCMD system option, it is important to note that DM statements cannot be included in an autoexec file nor can they be included within the SAS/AF application that has been invoked. To invoke a SAS/AF application with INITCMD, you simply specify your AF command as follows:
-initcmd "af c=myLib.myCatalog.primary.frame" |
In this example, the library referenced by the libref MYLIB is allocated with a LIBNAME statement included in an autoexec file. Exiting from an application invoked with INITCMD will also terminate your SAS session.
The INITCMD system option must either be included in the SAS configuration file or specified as an option in the SAS command; consequently, the syntax for this option is host dependent. For example, if you are running SAS under Microsoft Windows, you can include the INITCMD system option in your SAS command as follows:
C:\Program Files\SAS\sas.exe -autoexec c:\sas\init.sas -initcmd "af c=myLib.myCatalog.primary.frame" |
Refer to the SAS documentation for your host operating system for additional information on the INITCMD system option.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Date Modified: | 2006-04-18 03:02:52 |
Date Created: | 2005-08-04 17:14:58 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/AF | All | 6.12 | n/a |