Chapter 5: Identifying and Correcting SAS Language Errors

  1. Correct answer: a
    To correct errors in programs when you use the Editor window, you usually need to recall the submitted statements from the recall buffer to the Editor window. After correcting the errors, you can resubmit the revised program. However, before doing so, it is a good idea to clear the messages from the SAS log so that you do not confuse the old error messages with the new messages. Remember to check the SAS log again to verify that your program ran correctly.
  2. Correct answer: d
    The missing quotation mark in the LABEL statement causes SAS to misinterpret the statements in the program. When you submit the program, SAS is unable to resolve the PROC step, and a PROC PRINT running message appears at the top of the active window.
  3. Correct answer: c
    Syntax errors generally cause SAS to stop processing the step in which the error occurred. When a program that contains an error is submitted, messages regarding the problem also appear in the SAS log. When a syntax error is detected, the SAS log displays the word ERROR, identifies the possible location of the error, and gives an explanation of the error.
  4. Correct answer: c
    Syntax errors occur because the program statements did not conform to the rules of the SAS language. Syntax errors, such as misspelled keywords, generally prevent SAS from executing the step in which the error occurred.
  5. Correct answer: b
    When you submit a SAS statement that contains an invalid option, a log message notifies you that the option is not valid or not recognized. You should recall the program, remove or replace the invalid option, check your statement syntax as needed, and resubmit the corrected program.
  6. Correct answer: b
    The DATA step contains a misspelled keyword (dat instead of data). However, this is such a common (and easily interpretable) error that SAS produces only a warning message, not an error.
  7. Correct answer: c
    This program contains an unbalanced quotation mark. When you have an unbalanced quotation mark, SAS is often unable to detect the end of the statement in which it occurs. Simply adding a quotation mark and resubmitting your program usually does not solve the problem. SAS still considers the quotation marks to be unbalanced. To correct the error, you need to resolve the unbalanced quotation mark before you recall, correct, and resubmit the program.
  8. Correct answer: b
    Without a RUN statement (or a following DATA or PROC step), the DATA step does not execute, so it continues to run. Unbalanced quotation marks can also cause the DATA step running message if relatively little code follows the unbalanced quotation mark. The other three problems that the quiz question mentions also generate errors or warnings in the SAS log.
  9. Correct answer: c
    A logic error occurs when the program statements follow the rules and execute, but the results are not correct. You can use the PUTLOG statement in the DATA step to help identify logic errors.
Last updated: August 23, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.249.42