SAS Chapter 6 Understanding Data Step Processing

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Moxleyv
M
Moxleyv
Community Contributor
Quizzes Created: 38 | Total Attempts: 21,748
| Attempts: 782
SettingsSettings
Please wait...
  • 1/10 Questions

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

    • The data set descriptor
    • The first observation
    • The program data vector
    • The _N_ and _ERROR_ automatic variables
Please wait...
SAS Quizzes & Trivia
About This Quiz

This quiz assesses understanding of SAS DATA Step Processing, focusing on the compilation and execution phases. It evaluates knowledge of syntax errors, variable initialization, and error handling in SAS programming, essential for data analysts and statisticians.


Quiz Preview

  • 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?

    • Incorrect values and formats

    • Invalid options or variable names

    • Missing or invalid punctuation

    • 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...

    • Once for each compilation phase.

    • Once for each DATA step statement.

    • Once for each record in the input file.

    • Once for each variable in the input file.

    Correct Answer
    A. 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:

    • 0

    • 1

    • Undefined

    • Missing

    Correct Answer
    A. 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?

    • 0

    • 1

    • 2

    • 3

    Correct Answer
    A. 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?

    • The automatic variables _N_ and _ERROR_ are incremented by one.

    • The DATA step stops execution.

    • The descriptor portion of the data set is written.

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

    Correct Answer
    A. 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;

    • IDnum Item InStock BackOrd Total

    • Item IDnum InStock BackOrd Total

    • Total IDnum Item InStock BackOrd

    • 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...

    • Data set variables will contain missing values.

    • The DATA step does not compile.

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

    • The DATA step still compiles and executes.

    Correct Answer
    A. 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;

    • Missing semicolon on the second line

    • Missing semicolon on the third line

    • Incorrect order of variables

    • 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 keyword was misspelled in the DATA step.

    • A semicolon was missing from the INFILE statement.

    • A variable was misspelled in the INPUT statement.

    • A dollar sign was missing in the INPUT statement.

    Correct Answer
    A. 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 (Updated): Mar 21, 2023 +

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.