SAS Chapter 3 Editing And Debugging SAS Programs

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Moxleyv
M
Moxleyv
Community Contributor
Quizzes Created: 38 | Total Attempts: 21,511
Questions: 11 | Attempts: 955

SettingsSettingsSettings
SAS Quizzes & Trivia

Practice preparing for the basic SAS certification exam


Questions and Answers
  • 1. 

    As you write and edit SAS programs it's a good idea to

    • A.

      Begin DATA and PROC steps in column one.

    • B.

      Indent statements within a step.

    • C.

      Begin RUN statements in column one

    • D.

      Do all of the above.

    Correct Answer
    D. Do all of the above.
    Explanation
    Although you can write SAS statements in almost any format, a consistent layout enhances readability and enables you to understand the program's purpose.

    Rate this question:

  • 2. 

    Suppose you have submitted a SAS program that contains spelling errors.  Which set of steps should you perform, in the orders shown to revise and resubmit the program?

    • A.

      Correct the errors. Clear the Log window. Resubmit the program. Check the Log window.

    • B.

      Correct the errors. Resubmit the program. Check the output window Check the Log window.

    • C.

      Correct the errors. Clear the Log window. Resubmit the program. Check the Output window.

    • D.

      Correct the errors. Clear the Output window. Resubmit the program. Check the output window.

    Correct Answer
    A. Correct the errors. Clear the Log window. Resubmit the program. Check the Log window.
    Explanation
    To modify programs that contain errors, if you use the Program Editor window, you usually need to recall the submitted statements from the recall buffer to the Program Editor window, where you can correct the problems. After correcting the errors, you can resubmit the revised program. However, before doing so, it's idea to clear the messages from the Log window so that you don't confuse the old error messages with the new messages. Remember to check the Log window again to verify that you program ran correctly.

    Rate this question:

  • 3. 

    What happens if you submit the following program? proc sort data=clinic.stress out=maxrates;      by maxhr; run; proc print data=maxrates label double noobs;      label rechr='Recovery Heart Rate;      var resthr maxhr rechr date;      where toler='I' and resthr>90;      sum fee; run;

    • A.

      Log messages indicate that the programs ran successfully.

    • B.

      A "PROC SORT running" message appears a the top of the active window, and a log message may indicate an error in a statement that seems to be valid.

    • C.

      A log message indicates that an option is not valid or not recognized.

    • D.

      A "PROC PRINT running" message appears at the top of the active window, and a log message may indicate that a quoted string has become too long or that the statement is ambiguous.

    Correct Answer
    D. A "PROC PRINT running" message appears at the top of the active window, and a log message may indicate that a quoted string has become too long or that the statement is ambiguous.
    Explanation
    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.

    Rate this question:

  • 4. 

    What generally happens when a syntax error is detected?

    • A.

      SAS continues processing the step.

    • B.

      SAS continues to process the step, and the Log window displays messages about the displays messages about the error.

    • C.

      SAS stops processing the step in which the error occurred, and the Log window displays messages about the error.

    • D.

      SAS stops processing the step in which the error occurred and the Output window displays messages about the error.

    Correct Answer
    C. SAS stops processing the step in which the error occurred, and the Log window displays messages about the error.
    Explanation
    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.

    Rate this question:

  • 5. 

    A syntax error occurs when

    • A.

      Some data values are not appropriate fore the SAS statements that are specified in a program.

    • B.

      The form of the elements in a SAS statement is correct, but the elements are not valid for that usage.

    • C.

      Program statements that do not conform to the rules of the SAS language.

    • D.

      None of the above

    Correct Answer
    C. Program statements that do not conform to the rules of the SAS language.
    Explanation
    Syntax errors are common types of errors. Some SAS system options, features of the code editing window, and the DATA step debugger can help you identify syntax errors. Other types of errors include data errors (a), semantic errors (b), and execution-time errors.

    Rate this question:

  • 6. 

    How can you tell whether you have specified an invalid option in a SAS program?

    • A.

      A log message indicates an error in a statement that seems to be valid.

    • B.

      A log message that indicates that an option is not valid or not recognized.

    • C.

      The message "PROC running" or "DATA step running" appears at the top of the active window.

    • D.

      You can't tell until you view the output from the program.

    Correct Answer
    B. A log message that indicates that an option is not valid or not recognized.
    Explanation
    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.

    Rate this question:

  • 7. 

    Which of the following programs contains a syntax error?

    • A.

      Proc sort data=sasuser.mysales;      by region; run;

    • B.

      Dat sasuser.mysales;      set mydata.sales99; run;

    • C.

      Proc print data=sasuser.mysales label;      label region='Sales Region'; run;

    • D.

      None of the above

    Correct Answer
    B. Dat sasuser.mysales;      set mydata.sales99; run;
    Explanation
    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.

    Rate this question:

  • 8. 

    What should you do after submitting the following program in the Windows or Unix operating environments? proc print data=mysales;      where state='NC; run;

    • A.

      Submit a RUN statement to complete the PROC step.

    • B.

      Recall the program. Then add a quotation mark and resubmit the corrected program.

    • C.

      Cancel the submitted statements. Then recall the program, add a quotation mark, and resubmit the corrected program.

    • D.

      Recall the program. Then replace the invalid option and resubmit the corrected program.

    Correct Answer
    C. Cancel the submitted statements. Then recall the program, add a quotation mark, and resubmit the corrected program.
    Explanation
    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 does not solve the problem. SAS stills 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.

    Rate this question:

  • 9. 

    Which of the following commands opens a file in the code editing window?

    • A.

      File 'd:\programs\sas\newprog.sas'

    • B.

      Include 'd:\programs\sas\newprog.sas'

    • C.

      Open 'd:\programs\sas\newprog.sas'

    • D.

      All of the above

    Correct Answer
    B. Include 'd:\programs\sas\newprog.sas'
    Explanation
    One way of opening a file in the code editing window is by using the INCLUDE command. Using INCLUDE command enables you to open a single program or combine stored programs in a single window. To save a SAS program, you can use the FILE command.

    Rate this question:

  • 10. 

    Suppose you submit a short, simple DATA step.  If the active window displays message "DATA step running" for a long time, what probably happened?

    • A.

      You misspelled a keyword.

    • B.

      You forgot to end the DATA step with a RUN statement.

    • C.

      You specified an invalid data set option.

    • D.

      Some data values weren't appropriate for the SAS statements that you specified.

    Correct Answer
    B. You forgot to end the DATA step with a RUN statement.
    Explanation
    Without a RUN statement (or a following DATA or PROC step), the DATA step doesn't 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 above generate errors in the Log window.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 10, 2013
    Quiz Created by
    Moxleyv

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.