SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Quiz: Understanding DATA Step Processing

Select the best answer for each question and click Score My Quiz.

  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

  2. During the compilation phase, SAS software 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

  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 observation in the input data set.
     d.   once for each variable in the input data set.

  4. At the beginning of the execution phase, the value of _N_ is 1, the value of _ERROR_ is 0, and the value of the remaining variables is set to:

     a.   0
     b.   1
     c.   undefined
     d.   missing

  5. Suppose you run a program that causes three DATA step errors. What is the value of the automatic variable _ERROR_?

     a.   0
     b.   1
     c.   2
     d.   3

  6. At the end of the DATA step, three actions occur. The first two are:
    • The values in the program data vector are written to the data set as an observation.
    • Control returns to the top of the DATA step.
    What is the third action?

     a.   The automatic variable _N_ is incremented by one.
     b.   The DATA step resumes execution.
     c.   The descriptor portion of the data set is written.
     d.   The values of variables in the program data vector are reset to missing.

  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 $ 15-19 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

  8. If SAS software cannot interpret syntax errors . . .

     a.   data set variables will contain missing values.
     b.   the DATA step will not compile.
     c.   the DATA step will still compile, but not execute.
     d.   the DATA step will still compile and execute.

  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 second line
     b.   missing semicolon on third line
     c.   incorrect order of variables
     d.   incorrect variable type

  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.



back||next

Terms of Use & Legal Information | Privacy Statement