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!
%macro try;
%put *** first try ***;
%mend try;
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!
proc options option=(mautosource sasautos);
run;
1
PROC OPTIONS option=(mautosource sasautos);
2
RUN;
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).
Explanation : Verification that the options have been taken into account.
Copied!
proc options option=(mautosource sasautos);
run;
1
PROC OPTIONS option=(mautosource sasautos);
2
RUN;
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!
%try
%put %datatyp(abc);
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.