04-28-2017 12:34 PM
Basically if the macro was not created with the STORE and SOURCE options on the %macro statement, which requires the System option MSTORED and a permanent library referenced in the SASMSTORE option to be set you can't.
%copy can recover the source if the macro was compiled with the option.
options mstored SASMSTORE=fp; %macro test666/ store source; %put 111; %put 222; %mend test666; %copy test666/ source;
The above code sets the option mstored to allow storage, SASMSTORE=FP says that location in in MY permanent library FP. You would use your library.
The options are set on the macro state and the %copy will write this to the LOG:
%copy test666/ source; %macro test666/ store source; %put 111; %put 222; %mend test666;
If the question was asked because someone did not save the source code you are basically out of luck. Note that the SAS documentation emphasizes to Save the code.
04-28-2017 01:51 PM
The example code shows everything you need to do to create the macro catalog in the library and then recover the source.
The OPTIONS statement before the %macro statement shows the details.
04-28-2017 01:55 PM - edited 04-28-2017 01:58 PM
How if the macro was a stored macro:
content of test666.sas :
The option in config file: OPTIONS SASAUTOS=("D:\MYSAS\sasmacro");
In this case, I want to know/display the macro definition, but I am not the author of the macro. I don't know the content.how to display the definition then?