Chapter Contents |
Previous |
Next |
SAS Macro Language: Reference |
Generally, an autocall library is a directory containing individual files, each of which contains one macro definition. In Release 6.11 or later, an autocall library can also be a SAS catalog (see "Using SAS Catalogs as Autocall Libraries" below).
Operating Environment Information: Autocall Libraries on Different Hosts The term directory refers to an aggregate storage location that contains files (or members) managed by the host operating system. Different host operating systems identify an aggregate storage location with different names, such as a directory, a subdirectory, a maclib, a text library, or a partitioned data set. For more information, see the SAS Companion for your operating system.
Using Directories as Autocall Libraries |
To use a directory as a SAS autocall library, do the following:
Operating Environment Information: Autocall
Library Member Names On operating systems that allow filenames with
extensions, you must name autocall macro library members with a special extension,
usually
.SAS
. Look at the autocall macros on your system
provided by SAS Institute to determine whether names of files containing macros
must have a special extension at your site.
On MVS operating systems, you must assign the macro name as the name of the PDS member.
When storing files in an autocall library, remember the following:
Using SAS Catalogs as Autocall Libraries |
In Release 6.11 or later, you can use the CATALOG access method to store autocall macros as SOURCE entries in SAS catalogs. To create an autocall library using a SAS catalog, follow these steps:
libname mymacs 'SAS-data-library'; filename mymacros catalog 'mymacs.myautos';
Calling an Autocall Macro |
To call an autocall macro, the system options MAUTOSOURCE must be set and SASAUTOS must be assigned. MAUTOSOURCE enables the autocall facility, and SASAUTOS specifies the autocall libraries. For more information on these options, see MAUTOSOURCE and SASAUTOS in Chapter 13.
Once you have set the required options, calling an autocall macro is like calling a macro that you have created in your current session. However, it is important that you understand how the macro processor locates the called macro. When you call a macro, the macro processor searches first for a session compiled macro definition. Next, the macro processor searches for a permanently stored compiled macro. If compiled stored macros are enabled with the MSTORED option, the macro processor opens the macro catalog in the library specified in the SASMSTORE option. If the macro processor does not find a compiled macro, and if MAUTOSOURCE is set, the macro processor opens libraries specified by the SASAUTOS option in the order in which they are specified in the option. It then searches each library for a member with the same name as the macro you invoked. When SAS finds a library member with that name, the macro processor does the following:
Note: If an autocall library member
contains more than
one macro, the macro processor compiles all of the macros but executes only
the macro with the name you invoked.
Any open code statements in the same autocall library member as a macro execute only the first time you invoke the macro. When you invoke the macro later in the same session, the compiled macro is executed, which contains only the compiled macro definition and not the other code the autocall macro source file may have contained.
It is not advisable to change SASAUTOS during a SAS session. If you change the SASAUTOS= specification in an ongoing SAS session, the SAS System will store the new specification only until you invoke an uncompiled autocall macro and then will close all opened libraries and open all the newly specified libraries that it can open.
For information about debugging autocall macros, see Chapter 10, "Macro Facility Error Messages and Debugging."
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.