I know how to supress the notes in SAS by
options nonotes;
I am wondering how I can supress specific notes that have a certin text strings because I have to read though a huge log, but still want to see unexpected notes. For example, omit: WARNING: The variable ORDER in the DROP, KEEP, or RENAME list has never been referenced.
Be careful what you wish for!
It's one thing to suppress notes. It's quite another to suppress warnings. Warnings were designed by SAS to indicate that something may have gone wrong with your program. The results may be different than what you want or expect.
You might be better off writing a program that reads the log as a raw data file, then prints the results you are looking for. That way, the outcome is very much under your control, is more accurate than having a human read a huge log, and preserves all the original notes and warnings in case they are needed later.
I don't advise turning off warnings, but it is possible. I think it was @Ksharp who mentioned that you can suppress these messages:
options dkricond=nowarning dkrocond=nowarning ;
- Doc for the DKRICOND= option (Drop, Keep, Rename for Input)
- Doc for the DKROCOND= option (Drop, Keep, Rename for Output)
Be careful what you wish for!
It's one thing to suppress notes. It's quite another to suppress warnings. Warnings were designed by SAS to indicate that something may have gone wrong with your program. The results may be different than what you want or expect.
You might be better off writing a program that reads the log as a raw data file, then prints the results you are looking for. That way, the outcome is very much under your control, is more accurate than having a human read a huge log, and preserves all the original notes and warnings in case they are needed later.
I understand that warnings and errors are useful, but I run a custom version of SAS that has macros in the interface where there are macros I use that have warnings and notes I cannot change because I do not have permission. It seems clear that each warning need a custom way to get rid of the note so I'll just leave the code as is.
If you don't have permission to change the code you will have to live with the warnings.
The approach I take is to write code to begin with that does not produce warnings - it isn't that difficult. That means when a warning is written then something new has caused it to happen and needs investigation.
I would argue that code producing logs with warnings is not well written - how do you know then what is a new warning and should be checked out and what are "normal" warnings?
There is also the issue that a warning will cause a SAS job to have a non-zero return code. If you are running lots of SAS jobs, especially scheduled ones, then a zero return code is a sign that the job has run without any errors or warnings and does not need to be checked out.
You should NOT, and I mean NOT suppress such warnings, as they point to an error in the program, although one that does allow SAS to continue executing steps.
Identify the cause of the message, and remove it.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: