Say in my main code I have this code block:
%macros hi5;
%put hi five;
%mend;
%macros helloworld;
%put hello world;
%mend;
How do I, in SAS Enterprise Guide, display something like this? (via log or via a SAS table)
These are the user defined user macros:
hi5
hello world
(the aim is so that user is able to know what macros are already available to them).
Note: the %put _ALL_
only list all macros variables, not macros (e.g. built with %macros and %mend
.)
Re: Finding Location of SAS Macrosrun PROC OPTIONS and look for SASAUTOS in the log. It may give you a hint where to search the macro.
Become a Better Data Professional With Simplilearn These are two types of Macro variables, Global, Local, and a Macro program begins with a %MACRO and ends with a %MEND. Some commonly used Macros are - %END, %RETURN, and %PUT.
You can also use a %PUT Macro Statement to view available macro variables. %PUT provides several options that enable you to view individual categories of macro variables. The system option SYMBOLGEN displays the resolution of macro variables.
The %MACRO statement begins the definition of a macro, assigns the macro a name, and can include a list of macro parameters, a list of options, or both. A macro definition must precede the invocation of that macro in your code. The %MACRO statement can appear anywhere in a SAS program, except within data lines.
You can get there via PROC CATALOG
, or via dictionary.catalogs
. The latter will work even if you don't know where they're stored.
proc sql;
select *
from dictionary.catalogs
where objtype='MACRO';
quit;
That will include the predefined macros in SASHELP
, which you can exclude using where libname ne 'SASHELP'
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With