SAS DM (display manager) commands can be used to call windowing and text editor commands within a SAS program. In this example, the log is saved to a permanent file, and then it is cleared:
***put something in the log;
proc print data=sashelp.flags (obs=1);
run;
***save the log to a permanent file, overwriting if necessary;
dm 'log; file "C:\My files\log 1 &sysdate9..log" replace';
***Clear the log window;
DM "log; clear; ";
This tip was originally published by Mary Rosenbloom on sasCommunity.org.