03 July 2014

Understanding Errors in SAS log window

SAS is statistical Analysis software which is used to analyse a clinical trial raw data write a statistical or graphical analysis report that can be submitted to the FDA/DCGI for further approvals. Programmers perform errors during the SAS programming code, these errors are displayed within the SAS log window during compilation and the execution phases of SAS program processing. Programmers can debug SAS programming errors by understanding processing messages in the SAS log window and then fixing the code. Programmers can use the DATA Step Debugger to detect logical errors in a DATA step during execution.

There are different types of errors in SAS log window:

Syntax error, Semantic errors, Execution-time errors, Data errors, Macro-related errors

Syntax Errors:
Syntax errors occur when programming statements do not conform to the rules of the SAS language. When SAS encounters a syntax error, it first attempts to correct the error by attempting to interpret what the programming means. Then SAS continues processing the program based on its assumptions. If SAS cannot correct the error, it prints an error message to the log window.

But some syntax errors are explained fully by the message that SAS prints in the log; other error messages are not as easy to interpret because SAS is not always able to detect exactly where the error occurred. For example, when the programmer fails to end a SAS statement with a semicolon, SAS does not always detect the error at the point where it occurs because SAS statements are free-format (they can begin and end anywhere). SAS prints the word ERROR in the log, identifies the possible location of the error, and prints an explanation of the error and stops processing the DATA step.
Here are some examples of syntax errors: misspelled SAS keyword, unmatched quotation marks, missing semicolon, invalid statement option, invalid data set option.

Semantic Errors:

Semantic errors occur when the forms of the elements in SAS statements are correct, but the elements are not valid for that usage. Semantic errors are detected at compile time and can cause SAS to enter syntax check mode. Examples of semantic errors include the following: specifying the wrong number of arguments for a function, using a numeric variable name where only a character variable is valid, using illegal references to an array.

Execution-Time Errors:
Execution-time errors are the errors that occur when SAS executes a program that processes data values. Most execution-time errors produce warning messages or notes in the SAS log but allow the programs to continue executing. The location of an execution-time error is usually given as line and column numbers in a note or error message.
Common execution-time errors include the following: Illegal arguments to functions, illegal mathematical operations, observations in the wrong order for BY-group processing, when the array's subscript is out of range, open and close errors on SAS data sets and other files in INFILE and FILE statements, INPUT statements that do not match the data values (for example, an INPUT statement in which list of wrong columns for a variable or fail to indicate that the variable is a character variable).

Data Errors:
Data error occurs when some data values are not appropriate for the SAS statements that have specified in the program. For example, if a variable is defined as numeric, but the data value is actually character, SAS generates a data error. SAS detects data errors during program execution and continues to execute the program, and does the following: writes an invalid data note to the SAS log, prints the input line and column numbers that contain the invalid value in the SAS log. Unprintable characters appear in hexadecimal. To help determine column numbers, SAS prints a rule line above the input line, prints the observation under the rule line, and sets the automatic variable _ERROR_ to 1 for the current observation.

Macro programming related errors:
Several types of macro-related errors exist: macro compilation time errors and macro execution-time errors are generated when macro facilities are used; these errors in the SAS log window are produced by the macro facility.

Conclusion: All type of errors are displayed in the Log window, with some colour enhancement options, which will internally help SAS programmers to debug the programming errors that are generated during the programming code.


Clinnovo is a clinical innovation company. It is pioneer CRO industry in India. Clinnovo offers professional clinical research course , clinical data management course , SAS Courses and imaging training. Clinnovo has been serving different bio-pharma industries across the world with excellence and high quality. For more information contact at +91 9912868928, 040 64635501

No comments:

Post a Comment