04-03-2014 12:05 PM
The method in which to view it depends upon it how it has been placed into you session. Do you know if the macro is initialized through an autocall library or a compiled catalog, a %include statement, etc...?
04-03-2014 12:29 PM
You have a %include statement pointing to the source code for the macro (a .sas file)?
You can open that .sas file in a text editor (inlcuding a program editor).
04-03-2014 12:38 PM
I just realized that maybe the question is, can I view the code generated by a macro without invoking it? If this is the case, the most simplistic answer is, no.
If this is not the case, as Quentin said, since you are using the %include, you already have the explicit path to the macro program, so, just open if up in you preferred text editor for SAS code and take a look...
04-03-2014 01:42 PM
Is the question about a stored macro, and you know where it is stored? If so, there is a way to do it.
Suppose I created a macro called mymacro and stored it in a library in C:\macrolib.
In a later SAS session I want to see what code is in that macro.
I can do that, without invoking the macro, by using %copy.
options mstored sasmstore=mylib;
libname mylib "C:\macrolib";
The macro code will be in the SAS log. The macro is not invoked.
04-03-2014 02:16 PM
there are a number of include statements which all contain macros. I was just seeing if I could bring up the code for one instead of hunting it down!
04-03-2014 03:08 PM
If you are using Display Manager you could convert your %include statements to dm 'include'. For example: dm "include 'c:\mymacro' "; This will bring the code into the SAS editor without running it.
04-04-2014 02:15 PM
You could also read the catalog's macro entry, however, due to the quoting obfuscations it can get fairly messy:
/* default work macro catalog is work.sasmacr, if you are using enterprise guide then it is sasmac1 instead, by default */
filename x catalog 'work.sasmac1.YOUR MACRO NAME HERE.macro' ;
04-04-2014 05:25 PM
Set the SOURCE2 option of add / SOURCE2 option to the %INCLUDE statements and you will see the macro code in the SAS log when the %INCLUDE statement runs.
options source2 ;
%include 'mymacro.sas' / source2 ;