Macro Facility under UNIX |
What Is an Autocall Library? |
An autocall library contains files that define SAS macros. The following sections discuss aspects of autocall libraries that are dependent on the operating environment. For more information, see SAS Macro Language: Reference.
Available Autocall Macros |
There are two types of autocall macros, those macros that are provided by SAS, and those macros that you define yourself. To use the autocall facility, you must have the MAUTOSOURCE system option set.
When SAS is installed, the SASAUTOS system option is defined in the configuration file to refer to the location of the default macros supplied by SAS. The products licensed at your site determine the autocall macros you have available. You can also define your own autocall macros and store them in one or more directories. SAS does not recognize autocall macros if their filenames are written in uppercase or in mixed case. Use only filenames that are lowercase.
Macro names in SAS are case insensitive, but they all map to a lowercase filename. If you store autocall macros in a UNIX directory, the file extension must be .sas, and the filename must be entirely in lowercase. In the UNIX environment, each macro file in the directory must contain a macro definition with a macro name that matches the filename. For example, a file named prtdata.sas should define a macro named prtdata.
The SASAUTOS System Option |
To use your own autocall macros in your SAS program, specify their directories with the SASAUTOS system option. For more information, see SASAUTOS System Option: UNIX.
Note: The SASAUTOS system option under UNIX does not recognize filenames that are in uppercase or mixed case.
You can set the SASAUTOS system option when you start SAS, or you can use it in an OPTIONS statement during your SAS session. However, autocall libraries specified with the OPTIONS statement override any previous specification.
If you use the CONFIG system option to specify a configuration file, add your autocall library to the library concatenation supplied by SAS. If you use the default configuration files (sasv9.cfg), specify your autocall library there.
Autocall libraries are searched in the order in which you specify them.
Example: Setting Up and Testing a Macro in an Autocall Library |
This example shows how to set up and test a macro in an autocall library.
The following output shows the results of executing two UNIX (cat ) commands to display the contents of two files, and a SAS command to run the autocall.sas program:
$ cat maclib/testauto.sas %macro testauto; x echo 'Autocall library is working.'; %mend testauto; $ cat source/autocall.sas filename sysautos ('!SASROOT/sasautos' '$HOME/test/sasautos'); options mautosource sasautos=(sysautos '$HOME/macros/maclib'); %testauto %TestAuto %TESTAUTO $ sas source/autocall.sas Autocall library is working. Autocall library is working. Autocall library is working.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.