DATA Step, Macro, Functions and more

Saving log files

Reply
Occasional Contributor
Posts: 12

Saving log files

I want to save SAS logs and I have used Proc Printto and dm 'log' file = 'option'. These procedures are not working due to presence of ODS statements are written throughout the program. 

Please suggest how do I save log files other than Printto and dm log options...

Super User
Posts: 6,934

Re: Saving log files

How is your SAS set up? Do you use SAS Studio, SAS Enterprise Guide, or basic Display Manager?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,401

Re: Saving log files

In my opinion this should be a program level setup.  Easiest way to "store" a log is to batch submit things, log is automatically stored in the same directory.  ODS shouldnit change proc printto, i.e. in my programs I need to write an rtf:

ods rtf file...;

 

ods rtf close;

 

This should not affect the log output.  Generally I would advise avoiding the use of redirection of this type for several reasons.  

Occasional Contributor
Posts: 12

Re: Saving log files

I have SAS 9.4
Super User
Posts: 3,102

Re: Saving log files

One way to save logs automatically is to run your SAS program in batch. This does not require use of PROC PRINTTO and ODS output can be controlled by writing it to files. 

Super User
Posts: 17,786

Re: Saving log files

What do you mean by SAS logs?
Occasional Contributor
Posts: 12

Re: Saving log files

I mean, when we run SAS codes there is log generated. I want to save that log as a txt file

Super User
Posts: 6,934

Re: Saving log files

The question stays, in what mode do you run your SAS codes: interactive (display manager, SAS Studio, Enterprise Guide) or in batch?

If in batch, you need a wrapper script that consistently specifies a location and filename for your logs. If you include program name, date&time, and process number in the filename of the log file, you will get a complete documentation of every batch run.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 17,786

Re: Saving log files

How is ODS affecting your log?

Ask a Question
Discussion stats
  • 8 replies
  • 631 views
  • 1 like
  • 5 in conversation