DATA Step, Macro, Functions and more

SAS LOG

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

SAS LOG

Hi All,

 

Hope all are doing great. Have a great day...!

 

I have a question regarding SAS Log.

 

I had come across certain ways of reading and creating external SAS LOG.

 

My question here is from where do NOTE, ERROR and WARNING are being obtained and printed in SAS LOG.

 

For example:

We can see in LOG window message "NOTE: There are xxx no of observation read from yy.zzz dataset.

so, from where this information is coming to LOG window. Similarly, for others like ERROR, WARNING and other related log messages.

 

Thanks for your time in reading my post.

 


Accepted Solutions
Solution
‎01-07-2017 11:13 AM
Respected Advisor
Posts: 3,900

Re: SAS LOG

[ Edited ]

Read below and then make the call what best suits your requirements.

 

SAS(R) 9.4 Logging: Configuration and Programming Reference, Second Edition

http://support.sas.com/documentation/cdl/en/logug/67485/HTML/default/viewer.htm#titlepage.htm 

 

Have you already searched the communities for similar questions? How to parse log files is something that regularly pops up.

 

https://communities.sas.com/t5/Base-SAS-Programming/Question-on-reading-SAS-logs-into-a-SAS-dataset-...

 

https://communities.sas.com/t5/Base-SAS-Programming/SAS-Batch-read-log-of-current-program/m-p/312809...

 

 

 

 

View solution in original post


All Replies
Contributor
Posts: 24

Re: SAS LOG

Hi.

 

Sorry, not clear for me what you are looking for...

 

What do you mean by "where this information is comming from"?

 

If it's just a matter of disabling those messages, check the following note: http://support.sas.com/kb/24/487.html

 

Daniel Santos @ www.cgd.pt

Frequent Contributor
Posts: 96

Re: SAS LOG

I guess, Creating external log means that you want to print log information to external file, here is the sample code to do this,

PROC PRINTTO PRINT='c:\auto.lst' NEW;
RUN;

 Regarding printing details(eg: WARNING, ERROR, NOTE) in log,

As @Daniel-Santossuggested one link, you can change that paramters.

Respected Advisor
Posts: 3,900

Re: SAS LOG

The SAS log is created by SAS when you execute it - it's part of the product. You can to a certain degree influence the level of logging via a whole set of options like NOTES SOURCE SYMBOLGEN FULLSTIMER etc. etc.

Regular Contributor
Posts: 194

Re: SAS LOG

[ Edited ]

If the question is how to generate your own notes, warnings and error messages for the programs you develop,

it is just a matter of writing to the log with the appropriate keywords.

Here is an example with a data step.

 

data _NULL_;
put "NOTE: this is a note";
put "WARNING: and a warning";
put "ERROR: and an error";
run;

SAS will recognize the keywords NOTE, WARNING and ERROR dand dispay the messages with the corresponding

color highlighting.

 

If, on the other hand, you want to modify the messages displayed by SAS procedures, those are builtin features and you

can not do more than change the level of logging as proposed by @Patrick.

Contributor
Posts: 24

Re: SAS LOG

 

 

I will add to @gamotte solution the fact that you may favor PUTLOG statement instead of PUT as the former always writes to the log.

 

PUT writes to log or to a file if you specified a FILE statement inside your datastep, for example:

 

data _null_;

     file MYFILE;

     put 'ERROR:...'; * writes to the file;

     putlog 'ERROR...'; * writes to the log;

run;

 

But PUTLOG is not exactly the same as PUT (when writting to the log), check here for more info: http://support.sas.com/kb/40/403.html

 

Hope it helps.

 

Daniel Santos @ www.cgd.pt

 

 

 

Contributor
Posts: 52

Re: SAS LOG

The SAS log is a record of everything you do in your SAS session or with your SAS program. the SAS log messages may begin with the words NOTE, INFO, WARNING, ERROR, or an error number, and they may refer to a SAS statement by its line number in the log.

 

For more info on SAS log and ways to supress some of the notes/log statements, you can refer- 

https://v8doc.sas.com/sashtml/lrcon/z0998454.htm


Cheers from India!

Manjeet
Occasional Contributor
Posts: 14

Re: SAS LOG

Hi All,

 

Thank you for your time and reply.

 

My requirement is to read and consolidate the log.

 

I have two different ways to read log, 1. Proc printto and 2. DM statement. But, both of this havent given me a solution of reading the log simultaneously while program is excuting. Please suggest if any others.

 

Please see below what I am trying to do.

 

When a User creating program and executing it. During the execution of program it should read log and consolidate all the mistakes in log and bring it as a separate dataset.

 

Thank you..!

Solution
‎01-07-2017 11:13 AM
Respected Advisor
Posts: 3,900

Re: SAS LOG

[ Edited ]

Read below and then make the call what best suits your requirements.

 

SAS(R) 9.4 Logging: Configuration and Programming Reference, Second Edition

http://support.sas.com/documentation/cdl/en/logug/67485/HTML/default/viewer.htm#titlepage.htm 

 

Have you already searched the communities for similar questions? How to parse log files is something that regularly pops up.

 

https://communities.sas.com/t5/Base-SAS-Programming/Question-on-reading-SAS-logs-into-a-SAS-dataset-...

 

https://communities.sas.com/t5/Base-SAS-Programming/SAS-Batch-read-log-of-current-program/m-p/312809...

 

 

 

 

Occasional Contributor
Posts: 14

Re: SAS LOG

Thank you Patrick. 

Occasional Contributor
Posts: 14

Re: SAS LOG

Guys everyone thank you for time and response.

 

Best Regards,

Praveen 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 329 views
  • 2 likes
  • 6 in conversation