BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bubblui
Calcite | Level 5

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

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

10 REPLIES 10
Daniel-Santos
Obsidian | Level 7

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

Kalind_Patel
Lapis Lazuli | Level 10

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.

Patrick
Opal | Level 21

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.

gamotte
Rhodochrosite | Level 12

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.

Daniel-Santos
Obsidian | Level 7

 

 

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

 

 

 

mnjtrana
Pyrite | Level 9

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
bubblui
Calcite | Level 5

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

Patrick
Opal | Level 21

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

 

 

 

 

bubblui
Calcite | Level 5

Thank you Patrick. 

bubblui
Calcite | Level 5

Guys everyone thank you for time and response.

 

Best Regards,

Praveen 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 10 replies
  • 2385 views
  • 2 likes
  • 6 in conversation