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.
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.
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
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.
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.
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.
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
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
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..!
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.
Thank you Patrick.
Guys everyone thank you for time and response.
Best Regards,
Praveen
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.