Although you can write
SAS statements in almost any format, a consistent layout enhances
readability and enables you to understand the program's purpose.
It is a good idea to begin DATA and PROC steps in column one, to indent
statements within a step, to begin RUN statements in column one, and
to include a RUN statement after every DATA step or PROC step.
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 Log window so that you do not confuse the old error messages
with the new messages. Remember to check the Log window again to verify
that your program ran correctly.
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.
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 Log window. When a syntax error is
detected, the Log window displays the word ERROR, identifies the possible
location of the error, and gives an explanation of the error.
Correct answer: c
Syntax errors are common
types of errors. Some SAS system options and features of the code
editing window can help you identify syntax errors. Other types of
errors include data errors and logic errors.
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.
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.
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.
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 Log window.
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.