BookmarkSubscribeRSS Feed
Zoe_Steven
Calcite | Level 5
Hi All,

 

I am working on checking the logs in SAS v9.4. There are many papers about check for issues from external files saved as *.log. But I'd like to read the SAS log of current program, and can't find any relevant papers.

 

What is the option or procedure to read the SAS log of my current program and check for the issues?

 

Thanks,

Zoe

9 REPLIES 9
Reeza
Super User
Use PROC PRINTTO to push the log, current log, to a file and then you can read the log in as any other file.

Depending on what you're doing, PROC SCAPROC may be of use as well. You may also want to look into the automatic SAS macro variables that indicate different error types.
Zoe_Steven
Calcite | Level 5

Thank you so much, Reeza. 

 

I just tried to use PROC PRINTTO, but it seems this statement would store the current logs in a external file, and the LOG tab of SAS would display nothing. what I expected is to keep the log message in the LOG tab of SAS, and read and check the log message and output the log summary in the LOG tab as well. For example, output the error and warning messages.

SASKiwi
PROC Star

@Zoe_Steven  - An alternative to PROC PRINTTO is the ALTLOG system option which creates a copy of the log in a file in addition to keeping the original log: https://documentation.sas.com/?docsetId=hostwin&docsetTarget=n02cl0iq0k1fmxn11p83yirplodk.htm&docset...

Zoe_Steven
Calcite | Level 5

Thanks, @Kurt_Bremser , but I have to reinvent, since what we are using is not EG

SASKiwi
PROC Star

Your SAS log has to be written to a file stored on disk before it can be read by a SAS program. Whether you save it manually or use @Reeza 's suggestion to write it automatically using PROC PRINTO the end result is a file on disk.

Zoe_Steven
Calcite | Level 5

Many thanks, @SASKiwi .

 

I just found another way to output the current SAS log using DM statement.

 

dm 'log; file ".\xx.log" replace';

SASKiwi
PROC Star

@Zoe_Steven  - Great, I was aware of that one too, although that only works in the SAS Windowing Environment. It won't work if you use SAS Enterprise Guide as your user interface.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 833 views
  • 0 likes
  • 4 in conversation