The web browser trick: A little-known but very effective solution is to open your .log file directly with a browser (Internet Explorer, Chrome, Edge, etc.). The browser does not lock the file and displays the text correctly (especially if the extension is .log, the formatting remains readable).
Note : The "Dashboard" Solution: PROC PRINTTO and HTML
To go beyond simple text reading, you can redirect your logs to an HTML format. This allows you to create real monitoring dashboards (with colored statuses: green for finished, yellow for in progress, etc.).
The idea is to use the PROC PRINTTO procedure to route the log to an HTML file. Here is an example of a macro proposed by the community:
%MACRO PRINTTO(_logPath=, _jobID=, _jobName=);
%LOCAL dt;
%LET dt = %sysFunC(dateTime(), DATETIME16.);
/* Initialisation du fichier HTML */
FILENAME L_PATH "&_logPath";
DATA _null_;
file L_PATH;
put "<PRE>"; /* Balise pour conserver le formatage */
RUN;
FILENAME L_PATH CLEAR;
/* Redirection de la log */
PROC PRINTTO LOG = "&_logPath";
RUN;
%PUT NOTE: Job &_jobID - &_jobName a demarre a &dt;
%MEND;
1
%MACRO PRINTTO(_logPath=, _jobID=, _jobName=);
2
%LOCAL dt;
3
%LET dt = %sysFunC(dateTime(), DATETIME16.);
4
5
/* Initialisation du fichier HTML */
6
FILENAME L_PATH "&_logPath";
7
DATA _null_;
8
file L_PATH;
9
put "<PRE>"; /* Balise pour conserver le formatage */
10
RUN;
11
FILENAME L_PATH CLEAR;
12
13
/* Redirection de la log */
14
PROC PRINTTO LOG = "&_logPath";
15
RUN;
16
17
%PUT NOTE: Job &_jobID - &_jobName a demarre a &dt;
18
%MEND;
By opening this HTML file in a browser and using automatic refresh, you can comfortably track the progress of your jobs.
The Empty File Problem (Buffering)
Even if you manage to open the file, its size often remains stuck at 0 KB or does not update for long periods, even if the program is running.
Limitations: Although very useful, this option does not always guarantee an instant, second-by-second update (it also depends on the disk load and the OS), but it significantly reduces the delay in the appearance of logs.
You can also combine this with the -logparm option:
-logparm "write=immediate rollover=session"
4. Third-party Tools: Bringing Unix to Windows
If you miss tail -f too much, the radical solution is to install utilities that bring Unix commands to Windows. Tools like GnuWin32, UnxUtils, or Cygwin allow you to use tail on Windows to monitor your log files exactly as you would on a Linux server.
The codes and examples provided on WeAreCAS.eu are for educational purposes. It is imperative not to blindly copy-paste them into your production environments. The best approach is to understand the logic before applying it. We strongly recommend testing these scripts in a test environment (Sandbox/Dev). WeAreCAS accepts no responsibility for any impact or data loss on your systems.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.