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...
How is your SAS set up? Do you use SAS Studio, SAS Enterprise Guide, or basic Display Manager?
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.
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.
I mean, when we run SAS codes there is log generated. I want to save that log as a txt file
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.
How is ODS affecting your log?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.