Published on :
Macro CREATION_INTERNE

Autocall Macros Configuration and Testing

This code is also available in: Deutsch Español Français
This program first defines a simple local macro 'try'. It then displays the current macro-related options (MAUTOSOURCE, SASAUTOS). It modifies the SASAUTOS option to include a custom directory (defined by the &path variable) at the beginning of the search path. Finally, it checks the new options and tests the execution of the local macro and the standard autocall macro 'datatyp'.
Data Analysis

Type : CREATION_INTERNE


The script does not manipulate data tables. It acts on the configuration of the SAS session environment.

1 Code Block
MACRO DEFINITION
Explanation :
Definition of a local macro named 'try' that displays a message in the log.
Copied!
1%macro try;
2 %put *** first try ***;
3%mend try;
2 Code Block
PROC OPTIONS
Explanation :
Displaying the current configuration for macro source and search path (SASAUTOS).
Copied!
1PROC OPTIONS option=(mautosource sasautos);
2RUN;
3 Code Block
OPTIONS
Explanation :
Updating the SASAUTOS option to add a specific directory (constructed with the macro variable &path) before existing paths. Note: the use of the backslash suggests an original Windows environment, to be adapted for Linux (Viya).
Copied!
1options mautosource sasautos=("&path\my autocall macros", sasautos);
2 
4 Code Block
PROC OPTIONS
Explanation :
Verification that the options have been taken into account.
Copied!
1PROC OPTIONS option=(mautosource sasautos);
2RUN;
5 Code Block
MACRO CALL
Explanation :
Calling the previously defined local macro 'try' and calling the system autocall macro 'datatyp' to check the type of the value 'abc'.
Copied!
1%try
2 
3%put %datatyp(abc);
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.