DATA Step, Macro, Functions and more

How to display a macro definition?

Reply
Regular Contributor
Posts: 241

How to display a macro definition?

[ Edited ]

 Hello ALL,

 

A macro named test666 stored at "D:\MYSAS\sasmacro\test666.sas"

   content of test666.sas :

        %macro test666;
             %put 111;
             %put 222;
        %mend test666;

 

The option in config file:  OPTIONS SASAUTOS=("D:\MYSAS\sasmacro");

 

Here is my question:

         After I open a new windows SAS session, I want to display the definition of macro test666.what I should do?

 

Thanks!

Super User
Super User
Posts: 7,083

Re: How to display a macro definition?

Posted in reply to GeorgeSAS

Make a fileref that mimics the search path you have for your SASAUTOS setting and use that.

filename sa ("D:\MYSAS\sasmacro") ;

Then if you want to dump it to the log.

data _null_;
  infile sa('test666.sas');
  input;
  put _infile_;
run;

Or if you want to complile (or re-compile) it.

%include sa('test666.sas') / source2;

Or use the INCLUDE editor command.

include sa('test666.sas')
Super User
Posts: 19,878

Re: How to display a macro definition?

Posted in reply to GeorgeSAS

Why wouldn't just go the D location and open the file?

Ask a Question
Discussion stats
  • 2 replies
  • 116 views
  • 1 like
  • 3 in conversation