- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
While I review other's program,see code like this '%str(ERR)OR','%str(WARN)ING',why programming like this other than "%str(ERROR)",%strWARNING
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
my fault,it's '%str(warning)'
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Because they are using lazy log scanning tools that cannot tell the difference between the text ERROR in the code and an actual ERROR message generate by that code (or by SAS itself). By adding the extra macrro quoting (which is NOT needed) then the code no longer has the text ERROR as there is a ) in the middle of it. Using %STR(ERROR) would defeat that purpose.
Personally I use this grep string to search for ERROR messages and I do not get false positives from code lines echoed in the log.
grep '^ERROR.*:' myfile.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This is a convention we use in the SASjs Core library quite extensively.
This library was built to support lazy programmers, and sometimes the fastest way to search for an error in a log (especially within applications that do not support regex by default, such as a browser) is simply to CTRL+F and type "ERROR".
By breaking up the word ERROR into %str(ERR)OR, the number of false positives are drastically reduced. That is the only reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content