BookmarkSubscribeRSS Feed
RobP
Quartz | Level 8

I would like to see the results of the autoexec log in SAS Studio.  My normal autoexec file in SAS Studio simply looks like this:

 

%include "/folder/location/my_real_autoexec.sas";

 

I thought I'd be sneaky and just wrap it in a "proc printto" to redirect the log like this:

 

proc printto log="~/autoexec.log";
%include "/folder/location/my_real_autoexec.sas";
proc printto;run;

 

It created the file ~/autoexec.log, but when I open it, it only contains the following:

 

NOTE: PROCEDURE PRINTTO used (Total process time):
      real time           0.02 seconds
      cpu time            0.02 seconds

Is there a place I can see the autoexec log somewhere else?  A configuration option I can specify somewhere? Or a better way to use proc printto?

 

EDIT - Just to be clear, I want to see what GLOBAL/AUTOMATIC macro variables are available at the time autoexec runs vs at the time you can submit code manually.  So I can't use the 'run' feature that is supplied within SAS Studio.

2 REPLIES 2
Tom
Super User Tom
Super User

If you want to see the source for your included file then either set the SOURCE2 option or add the /SOURCE option to the %INCLUDE statement.

%include "/folder/location/my_real_autoexec.sas" / source;
ballardw
Super User

@RobP wrote:

I would like to see the results of the autoexec log in SAS Studio.  My normal autoexec file in SAS Studio simply looks like this:

 

%include "/folder/location/my_real_autoexec.sas";

 

I thought I'd be sneaky and just wrap it in a "proc printto" to redirect the log like this:

 

proc printto log="~/autoexec.log";
%include "/folder/location/my_real_autoexec.sas";
proc printto;run;

 

It created the file ~/autoexec.log, but when I open it, it only contains the following:

 

NOTE: PROCEDURE PRINTTO used (Total process time):
      real time           0.02 seconds
      cpu time            0.02 seconds

Is there a place I can see the autoexec log somewhere else?  A configuration option I can specify somewhere? Or a better way to use proc printto?

 

EDIT - Just to be clear, I want to see what GLOBAL/AUTOMATIC macro variables are available at the time autoexec runs vs at the time you can submit code manually.  So I can't use the 'run' feature that is supplied within SAS Studio.


You might look into the options for the %PUT statement also. You can specify lists of variables such as _all_ , _automatic_ ,  _global_ ,  _user_ , _readonly_ , _writable_  and/ or  _local_ (though _local_ generally doesn't mean much outside of a running macro).

%put _global_;

will show the current list of defined global macro variables and their values

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1794 views
  • 0 likes
  • 3 in conversation