I'm using the following code to save the log after running my program. The problem is that, if the log file already exists from a previous run, a dialog box pops up and asked if I want to Replace, Append, or Cancel. I want it to replace by default. This code runs without error, but the 'replace' command doesn't seem to do anything.
dm log 'file "P:\logs\ReportPrint..log"' replace;run;
Also, I know that I can use proc printto to save the log, but I prefer the dm statement so I can watch the log update in SAS as it runs.
My code looks like:
dm "log; file ""%sysfunc(pathname(work))/__mylog.log"" replace;";
So I quote the command, and there is a semicolon to separate the log command from the file command, and I also quote the path. So based on that, you could try:
dm 'log; file "P:\logs\ReportPrint.log" replace;' ;
It usually takes me some tinkering with the quotes etc, but should be doable.
My code looks like:
dm "log; file ""%sysfunc(pathname(work))/__mylog.log"" replace;";
So I quote the command, and there is a semicolon to separate the log command from the file command, and I also quote the path. So based on that, you could try:
dm 'log; file "P:\logs\ReportPrint.log" replace;' ;
It usually takes me some tinkering with the quotes etc, but should be doable.
That works, thanks!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.