SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
tinaz5012
Obsidian | Level 7

Hi 

I used proc printto to save logs, yet this way the log summary will not show if any error or warning. I am wondering if there is anyway that I can save all the log information while also could view the log summary?

 

Thank you!

 

Capture.JPG

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

The way to do this is to use the ALTLOG option. This sadly is only a startup option. it would be very useful to have the choice on the go.

An imperfect alternative is to re-read the log file:

option spool ;
proc printto log = "&wdir\tt.log" new;

proc sql; create table T as select 1 as X, 1 as X from SASHELP.CLASS; quit;
                                                         
proc printto log = log;

data _null_;
  infile  "&wdir\tt.log";
  input;
  putlog _infile_; 
run;

I see that you use EG. EG will highlight some messages, depending on its mood at the time and its version:

ChrisNZ_0-1628810218115.png

 

 

 

 

jimbarbour
Meteorite | Level 14

@ChrisNZ wrote:

I see that you use EG. EG will highlight some messages, depending on its mood at the time and its version:

EG 8.2 (and presumably subsequent versions) is a lot better than its predecessors.

 

Jim 

jimbarbour
Meteorite | Level 14

I dislike PRINTTO for that very reason.  In batch jobs, I use -ALTLOG which creates a copy of the log, but I've not tried setting that up in Enterprise Guide.  I'm not sure that ALTLOG would be supported in EG since it usually has to be specified at start up.

 

I think the best alternative in EG is to create a step in the Project that automatically exports your log.  It's not perfect, but it's generally workable.

 

Above the program editor window, there is a "Share" icon.  You would click on that and then "Log" and then "Export as a step in project."

jimbarbour_0-1628810348606.png

 

A wizard should open up.  Step through the wizard, making sure to uncheck "Overwrite existing output".

jimbarbour_1-1628811008969.png

 

SAS will automatically copy the log every time you run that part of the process and will embed a date time stamp in the filename. Unfortunately, macro variables are not resolved in this context.  😞

jimbarbour_3-1628811114419.png

 

Make sure you select and run both the program and the export step or the log will not be automatically saved.

 

Jim

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 1513 views
  • 2 likes
  • 3 in conversation