Usage Note 24451: Creating an autocall macro library on a PC

An AUTOCALL library on the PC is simply a directory that contains non-compiled MACRO code. The directory does not need to be in a specific location or to have a specific name. However, the MACRO code that is stored in the directory needs to be stored in a file that has the same name as the MACRO, and it needs to have a .sas extension. Here is an example:

%macro test;
%put hello;
%mend;

This MACRO needs to be stored in TEST.SAS. After the MACRO source code has been stored in an appropriately named file, SAS must know where to find the code before the MACRO can be invoked. You can accomplish this in two ways. One way to point to the AUTOCALL library is to add the directory path to the SASAUTOS system option, the SASV8.CFG files, or the SASV9.CFG files. Within the file, locate the SASAUTOS option, which looks like this:

The number of directories that are listed here depends on the number of SAS products that you have installed. The directories that are already listed in this option point to the AUTOCALL MACROS that are supplied by SAS. To add a library to the list, simply insert the directory path after the last directory that is listed. Here is an example:

Any number of AUTOCALL libraries can be appended to the current list. After the AUTOCALL libraries have been listed, save and close the file. Now the macros within these libraries can be invoked in any subsequent SAS sessions.

The second way to point to the AUTOCALL library is to use the SASAUTOS= system option in the code. This option lists the location of the AUTOCALL libraries. Here is the syntax:

FILENAME fileref 'the path to the AUTOCALL library';

This path goes only to the directory levelthe .sas macro filenames are not listed.

OPTIONS MAUTOSOURCE SASAUTOS=(SASAUTOS fileref);

The MAUTOSOURCE option turns on the autocall facility.
SASAUTOS is an automatic FILEREF that is created by SAS to point to the AUTOCALL libraries that are supplied by SAS. If this FILEREF is not listed in the option, SAS will not be able to find the AUTOCALL MACROS. Again, any number of autocall libraries can be listed in this option.

An efficient way to add this OPTION is to place the OPTION in the AUTOEXEC.SAS file. AUTOEXEC.SAS is a file that contains SAS statements that are executed automatically when SAS is invoked. The AUTOEXEC.SAS file can be used to specify some SAS OPTIONS, as well as LIBREFS and FILEREFS that are commonly used. Placing the OPTION in this file eliminates the need to list the OPTION in each piece of code that uses the AUTOCALL library.

If you have any questions about creating AUTOCALL libraries on the PC, contact Technical Support.

Operating System and Release Information

Product Family

Product

System

SAS Release

Reported

Fixed*

SAS System

Base SAS

Windows

n/a

*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.

Type:

Usage Note

Priority:

low

Topic:

SAS Reference ==> Macro

Date Modified:

2008-06-06 09:04:04

Date Created:

2005-10-27 15:51:48

This content is presented in an iframe, which your browser does not support.
To view the RateIT tab, click
here.