SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Quiz: Debugging and Testing DATA Steps

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

  1. When the SET statement is compiled, a slot is added to the program data vector for each variable in the input data set. The input data set supplies . . .

     a.   the data portion of the new SAS data set.
     b.   the descriptor portion of the new SAS data set.
     c.   values for automatically created variables.
     d.   variable names and attributes such as type and length.

  2. Look at the DATA step below. Not counting the automatic variables, how many variables should the program data vector contain?

    data region2.current;
       set region2.reps;
       Bonus=350;
       RepCurrent=salary+bonus;  
    run;
    Description of Region2.Reps
    Variable Type Length
    Rep C 3
    Salary N 8
    Region C 1
    Sale N 8

     a.   4
     b.   5
     c.   6
     d.   7

  3. Illegal mathematical operations or processing a character variable as a numeric variable are considered:

     a.   compile-time errors
     b.   execution-time errors
     c.   procedure step errors
     d.   program logic errors

  4. Syntax errors such as missing or invalid punctuation or misspelled keywords are considered:

     a.   compile-time errors
     b.   execution-time errors
     c.   procedure step errors
     d.   program logic errors

  5. When SAS software encounters a syntax error it . . .

     a.   ignores the statement and continues to the next one.
     b.   prints the contents of the program data vector.
     c.   tries to interpret your code.
     d.   stops interpreting your code.

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

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

  7. Which of these programs will run without error?

     a.  
    data work.loan1;
       set finance.loans
       if months>60;
       Interest=amount*(rate/12);
    run;
     b.  
    data work.loan1;
       set finance.loans;
       if months>60;
       Interest=amount*(rate/12);
    run;
     c.  
    data work.loan1;
       set finance.loans;
       of months>60;
       Interest=amount*(rate/12);
    run;
     d.  
    data work.loan1;
       set finance.loans;
       if months>60;
       Interest-amount*(rate/12);
    run;

  8. What is the result of submitting the following program?
    data _null_;
       set finance.loans;
       Interest=amount*rate;
    run;

     a.   No data set is created, but any program errors are written to the log.
     b.   A _NULL_ data set is created, but no program errors are written to the log.
     c.   Data set variables are created, but observations are not.
     d.   The program will not run.

  9. What is the result of submitting the following program?
    options obs=0;
    data finance.newcalc;
       set finance.loans;
       Interest=amount*rate;
    run;

     a.   No data set is created, but any program errors are written to the log.
     b.   A _NULL_ data set is created, but no program errors are written to the log.
     c.   Data set variables are created, but observations are not.
     d.   The program will not run.

  10. Suppose you expect the variable Code to contain a value of 1 or 2. To place a message in the log when other values occur, what statement should be used in your program?
    data work.test;
       if code='1' then Type='Variable';
       else if code='2' then Type='Fixed';
       else ... 'ALERT! bad value: ' code=;
    run;

     a.   DO
     b.   IF
     c.   PUT
     d.   THEN



back||next

Terms of Use & Legal Information | Privacy Statement