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

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 3197 views
  • 0 likes
  • 3 in conversation