Is there a way to have the log information appear in the log window and have it output to an external text file.
You can always save the LOG window to a text file.
You can also use the ALTLOG option to cause this to happen automatically.
Hi mate,
The SAS Log appears as standard in SAS Softwares, but in Enterprise Guide, if you need to
see the whole SAS Log history, you need to go to the process flow, click on project log and
click turn on to store the history of SAS Log in that session.
If you need to export the SAS Log use the proc printto or export by point-and-clicking.
proc printto log='use_a_macro_to_get_the_log_automatically.log';
run;
If you need this to happen automatically, then put this code into insert custom code after
submitted code.
Att
,
Thanks for the suggestions.
A little more detail from me would have helped.
I'm looking for a programmatic way to save the log file to an external text file.
And, if it is run interactively, to have the log also show in the log window.
I don't know if I can have my cake and eat it too by having the log automatically go to a text file and display in the log window.
From what I've read, it's one or the other.
Is this correct or can I have the log go to the window and a text file.
As I said, the ALTLOG option creates both the SASLOG in the LOG window, and a text file containing the SASLOG.
Jean, a sas code to do this is the proc printto like i said.
See this link: http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001330273.htm
Att
@DartibaliRodrigo wrote:
Jean, a sas code to do this is the proc printto like i said.
See this link: http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001330273.htm
Att
This does not meet the requirements stated. You don't get the log in BOTH the LOG window and in a text file. You only get the log in a text file.
The ALTLOG option does meet the requirements.
Agree with the altlog suggestion. If you're on PC SAS, you can also use DM commands to copy the log to a file, e.g. :
dm "log; file ""%sysfunc(pathname(work))/__mylog.log"" replace;";
Will write the contents of the log window to a file named __mylog.log in your work directory. I do this for quick log scanning during interactive sessions.
I find it easier to run SAS programs in batch mode if I want a LOG file as it gets produced automatically. That way no code changes are required.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.