SAS Chapter 6 Understanding Data Step Processing

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: 10 | Attempts: 781

SettingsSettingsSettings
SAS Quizzes & Trivia

Practice for the basic SAS certification exam.


Questions and Answers
  • 1. 

    Which of the following is not created during the compilation phase?

    • A.

      The data set descriptor

    • B.

      The first observation

    • C.

      The program data vector

    • D.

      The _N_ and _ERROR_ automatic variables

    Correct Answer
    B. The first observation
    Explanation
    At the beginning of the compilation phase, the program data vector is created. The porogram data vector includes the two automatic variables _N_ and _ERROR_. The descriptor portion of the new SAS data set is created at the end of the compilation phase. The descriptor portion includes the name of the data set, the number of observations and variables, and the names and attributes of the variables. Observations are not written until the execution phase.

    Rate this question:

  • 2. 

    During the compilation phase, SAS scans each statement in the DATA step, looking for syntax errors.  Which of the following is not considered a syntax error?

    • A.

      Incorrect values and formats

    • B.

      Invalid options or variable names

    • C.

      Missing or invalid punctuation

    • D.

      Missing or misspelled keywords

    Correct Answer
    A. Incorrect values and formats
    Explanation
    Syntax checking can detect many common errors, but it cannot verify the values of variables or the correctness of formats.

    Rate this question:

  • 3. 

    Unless otherwise directed, the DATA step executes...

    • A.

      Once for each compilation phase.

    • B.

      Once for each DATA step statement.

    • C.

      Once for each record in the input file.

    • D.

      Once for each variable in the input file.

    Correct Answer
    C. Once for each record in the input file.
    Explanation
    The DATA step executes once for each record in the input file, unless otherwise directed.

    Rate this question:

  • 4. 

    At the beginning of the execution phase, the value of _N_ is 1, the value of _ERROR_ is o, and the value variables are set to:

    • A.

      0

    • B.

      1

    • C.

      Undefined

    • D.

      Missing

    Correct Answer
    D. Missing
    Explanation
    The remaining variables are initialized to missing. Missing numeric values are represented by periods, and missing character values are represented by blanks.

    Rate this question:

  • 5. 

    Suppose you run a program that causes three DATA step erros.  What is the value of the automatic variable _ERROR_ when the observation that contains the third error is processed?

    • A.

      0

    • B.

      1

    • C.

      2

    • D.

      3

    Correct Answer
    B. 1
    Explanation
    The default value of _ERROR_ is 0, which means that there is no error. When an error occurs, whether one error or multiple errors, the value is set to 1.

    Rate this question:

  • 6. 

    Which of the following actions occurs at the end of an iteration of the DATA step?

    • A.

      The automatic variables _N_ and _ERROR_ are incremented by one.

    • B.

      The DATA step stops execution.

    • C.

      The descriptor portion of the data set is written.

    • D.

      The values of variables created in programming statements are re-set to missing in the program data vector.

    Correct Answer
    D. The values of variables created in programming statements are re-set to missing in the program data vector.
    Explanation
    By default, at the end of the DATA step, the values in the program data vector are written to the data set as an observation, the value of the automatic variable _N_ is incremented by one, control returns to the top of the DATA step, and the values of variables created in programming statements are re-set to missing. The automatic variable _ERROR_ retains its value.

    Rate this question:

  • 7. 

    Look carefully at the DATA step shown below.  Based on the INPUT statement, in what order will the variables be stored in the new data set? data perm.update;      infile invent;      input IDnum $ Item $ 1-13 Instock 21-22            BackOrd 24-25;      Total=instock+backord; run;

    • A.

      IDnum Item InStock BackOrd Total

    • B.

      Item IDnum InStock BackOrd Total

    • C.

      Total IDnum Item InStock BackOrd

    • D.

      Total Item IDnum InStock BackOrd

    Correct Answer
    A. IDnum Item InStock BackOrd Total
    Explanation
    The order in which variables are defined in the DATA step determines the order in which the variables are stored in the data set.

    Rate this question:

  • 8. 

    If SAS cannot interpret syntax errors, then...

    • A.

      Data set variables will contain missing values.

    • B.

      The DATA step does not compile.

    • C.

      The DATA step still compiles, but it does not execute.

    • D.

      The DATA step still compiles and executes.

    Correct Answer
    C. The DATA step still compiles, but it does not execute.
    Explanation
    When SAS can't interpret syntax errors, the DATA step compiles, but it does not execute.

    Rate this question:

  • 9. 

    What is wrong with this program? data perm.update;      infile invent      input Item $ 1-13 IDnum $ 15-19 Instock 21-22           BackOrd 24-25;      total=instock+backord; run;

    • A.

      Missing semicolon on the second line

    • B.

      Missing semicolon on the third line

    • C.

      Incorrect order of variables

    • D.

      Incorrect variable type

    Correct Answer
    A. Missing semicolon on the second line
    Explanation
    A semicolon is missing from the second line. It will cause an error because the INPUT statement will be interpreted as invalid INFILE statement options.

    Rate this question:

  • 10. 

    Look carefully at this section of a SAS session log.  Based on the note, what was the most likely problem with the DATA step? NOTE: Invalid data for IDnum in line 7 15-19. RULE: ----+----1----+----2----+----3----+----4 7       Bird Feeder LG088 3 20 Item=Bird Feeder IDnum=. InStock=3 BackOrd=20 Total=23 _ERROR_=1 _N_=1

    • A.

      A keyword was misspelled in the DATA step.

    • B.

      A semicolon was missing from the INFILE statement.

    • C.

      A variable was misspelled in the INPUT statement.

    • D.

      A dollar sign was missing in the INPUT statement.

    Correct Answer
    D. A dollar sign was missing in the INPUT statement.
    Explanation
    The third line of the log displays the values for IDnum, which are clearly character values. The fourth line displays the values in the program data vector and shows that the values for IDnum are missing, even though the values are correctly assigned. Thus, it appears that numeric values were expected for IDnum. A dollar sign, to indicate character values, must be missing from the INPUT statement.

    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 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 19, 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.