Chapter 11: Processing Data with DO Loops

  1. Correct answer: c
    DO loops are DATA step statements and cannot be used in conjunction with PROC steps.
  2. Correct answer: c
    The number of iterations is determined by the DO statement's stop value, which in this case is 12.
  3. Correct answer: a
    Use a DO loop to perform repetitive calculations starting at 1 and looping 15 times.
  4. Correct answer: d
    At the end of the 15th iteration of the DO loop, the value for Year is incremented to 2005. Because this value exceeds the stop value, the DO loop ends. At the bottom of the DATA step, the current values are written to the data set.
  5. Correct answer: b
    The OUTPUT statement overrides the automatic output at the end of the DATA step. On the last iteration of the DO loop, the value of Year, 2004, is written to the data set.
  6. Correct answer: d
    The number of observations is based on the number of times the OUTPUT statement executes. The new data set has 20 observations, one for each iteration of the DO loop.
  7. Correct answer: b
    Place the monthly calculation in a DO loop within a DO loop that iterates once for each year. The DO WHILE and DO UNTIL statements are not used here because the number of required iterations is fixed. A non-iterative DO group would not be useful.
  8. Correct answer: a
    The DO UNTIL condition is evaluated at the bottom of the loop, so the enclosed statements are always executed at least once.
  9. Correct answer: c
    Because the DO WHILE loop is evaluated at the top of the loop, you specify the condition that must exist in order to execute the enclosed statements.
  10. Correct answer: a
    The WHILE expression causes the DO loop to stop executing when the value of Distance becomes equal to or greater than 250.
Last updated: August 23, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.37.12