Skip to content

CheckLog Introduction

Chris Swenson edited this page Nov 15, 2020 · 12 revisions

About

The CheckLog macro reviews the current SAS log, external logs, or a directory of logs for issues, including lines with error, warning, invalid, or uninitialized messages. Further, additional messages have been identified that can be associated with issues, and some messages are ignored. CheckLog has several additional arguments for managing input, notifications, and how the macro operates.

Table of Contents

Features

  • Check the current log, an external log, or a directory of logs, including subdirectories (requires the DirList macro program).
    • The extension used to locate logs can be set (e.g., "txt" instead of "log")
    • For *nix users (Linux, Unix), switching DirList with LsList would be best. This would require light editing of the CheckLog macro program source code. Set the extension that is used in directory mode.
  • Add custom keywords to the search.
  • Exclude custom phrases, stored in a permanent data set.
  • Notify users by pop-up message, sound, or email.
  • Include additional detail in notifications.
  • Recreate the log in the current interactive SAS session by overwriting the current log with the imported log.
  • Abort the current SAS session when issues are found. This is useful for flow control.
  • Execute the macro from a keyboard shortcut or via a Windows icon or context menu (see Scripts page).
  • Support for UNIX, z/OS, OpenVMS, and Windows.
  • See the Arguments page for more details.
  • Note: In Enterprise Guide, CheckLog cannot export the current log. See the Enterprise Guide page for more details.

Issues Identified

The following keywords and phrases are identified by the CheckLog macro as issues.

  • Keywords: ERROR, WARNING, INVALID, UNINITIALIZED
  • Conversion
    • CHARACTER VALUES HAVE BEEN CONVERTED TO NUMERIC VALUES
    • NUMERIC VALUES HAVE BEEN CONVERTED TO CHARACTER VALUES
  • Format
    • AT LEAST ONE W.D FORMAT
  • Graph
    • OUTSIDE THE AXIS RANGE
  • Input
    • LOST CARD (input/infile data step)
    • NEW LINE WHEN INPUT
    • ONE OR MORE LINES WERE TRUNCATED (PROC IMPORT issue)
  • Math
    • DIVISION BY ZERO DETECTED
    • MATHEMATICAL OPERATIONS COULD NOT BE PERFORMED
    • MISSING VALUES WERE GENERATED
  • Merge
    • MERGE STATEMENT HAS MORE THAN ONE DATA SET WITH REPEATS OF BY VALUES
  • SQL
    • THE EXECUTION OF THIS QUERY INVOLVES PERFORMING ONE OR MORE CARTESIAN PRODUCT JOINS THAT CAN NOT BE OPTIMIZED
    • THE QUERY REQUIRES REMERGING SUMMARY STATISTICS BACK WITH THE ORIGINAL DATA
  • Syntax
    • A CASE EXPRESSION HAS NO ELSE CLAUSE
    • THE MEANING OF AN IDENTIFIER AFTER A QUOTED STRING MAY CHANGE

Issues Ignored

The following phrases are excluded from identification as issues. All keywords found in comments are excluded. However, CheckLog does not attempt to reconcile multi-line comments, which brings me back to the point above: avoid use of the keywords or mask their use. Masking the keywords in multi-line comments avoids identification of the comment as an issue. The specific messages excluded include variable messages, a couple of SAS-generated messages, and library messages which will result in more serious issues if they are used.

  • Variable Messages
    • "_ERROR_ = 0"
    • "IF _ERROR_"
    • "Set the error detection macro..."
  • SAS Messages
    • "The macro … completed compilation without errors."
    • "Your system is scheduled to expire on..."
    • "Errors printed on page..."
    • "Unable to copy SASUSER registry to WORK registory..."
  • Library Messages
    • "Error in the libname statement..."
    • "Only available to users with restricted session privilege..."
    • "The account is locked..."
    • "Unable to clear or reassign the library..."
    • "Unable to copy the SASUSER registry to work registry..."
    • "User does not have appropriate authorization level for..."

The last set of library messages was excluded because the environment in which I developed the macro, a default autoexec ran when SAS started that assigned several libraries I did not have rights to access. Since I could not modify the autoexec or disable the attempt to assign these libraries, these messages were useless when identified as issues. Further, libraries may or may not be used in any given program, and if they are used, other errors will indicate the source of the problem.

References