BookmarkSubscribeRSS Feed
tstjean
Calcite | Level 5

Is there a way to have the log information appear in the log window and have it output to an external text file.

8 REPLIES 8
PaigeMiller
Diamond | Level 26

You can always save the LOG window to a text file.

 

You can also use the ALTLOG option to cause this to happen automatically.

--
Paige Miller
DartRodrigo
Lapis Lazuli | Level 10

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

tstjean
Calcite | Level 5

,

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.

PaigeMiller
Diamond | Level 26

As I said, the ALTLOG option creates both the SASLOG in the LOG window, and a text file containing the SASLOG.

--
Paige Miller
DartRodrigo
Lapis Lazuli | Level 10

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

PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
Quentin
Super User

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.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
SASKiwi
PROC Star

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.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2121 views
  • 1 like
  • 5 in conversation