Hi Rick, thank you very much for the examples. I'm trying to use PrintToLog inside a loop to print in real time, but it works only if I add "call sleep(1);" before the call to PrintToLog. Do you know why? This is my code proc iml; %DefinePrintToLog; do i=1 to 5; a = j(99999,9999,9); call sleep(1); call PrintToLog("Loop #" + strip(char(i))); end; quit; However, in more complex cases this "trick" doesn't work.