Chapter 21: Creating Multiple Observations from a Single Raw Data Record

  1. Correct answer: d
    The double trailing at-sign (@@) enables the next INPUT statement to read from the current record across multiple iterations of the DATA step. It must be the last item specified in the INPUT statement. A record that is being held by the double trailing at-sign (@@) is not released until the input pointer moves past the end of the record, or until an INPUT statement that has no line-hold specifier executes.
  2. Correct answer: b
    Unlike the double trailing at-sign (@@), the single trailing at-sign (@) is automatically released when control returns to the top of the DATA step for the next iteration. The trailing @ does not toggle on and off. If another INPUT statement that has a trailing @ executes, the holding effect is still on.
  3. Correct answer: c
    Each record in this file contains three repeating blocks of data values for Item and Variety. The INPUT statement reads a block of values for Item and Variety, and then holds the current record by using the double trailing at-sign (@@). The values in the program data vector are written to the data set as the first observation. In the next iteration, the INPUT statement reads the next block of values for Item and Variety from the same record.
  4. Correct answer: d
    This raw data file contains an ID field followed by repeating fields. The first INPUT statement reads the values for ID and uses the @ line-hold specifier to hold the current record for the next INPUT statement in the DATA step. The second INPUT statement reads the values for Quantity. When all of the repeating fields have been read, control returns to the top of the DATA step, and the record is released.
  5. Correct answer: a
    The iterative DO statement begins the execution of a loop based on the value of an index variable. Here, the loop executes when the value of count ranges from 1 to 50, incremented by 5.
  6. Correct answer: a
    The OUTPUT statement must be in the loop so that each time a value for Activity is read, an observation is immediately written to the data set.
  7. Correct answer: c
    The DO WHILE statement checks for the condition that Cholesterol is greater than 200. The expression must be enclosed in parentheses. The expression is evaluated at the top of the loop before the loop executes. If the condition is true, the DO WHILE loop executes. If the expression is false the first time it is evaluated, the loop does not execute.
  8. Correct answer: b
    The sum statement adds the result of an expression to an accumulator variable. The + sign is an essential part of the sum statement. Here, the value of TotalPay is incremented by 1.
  9. Correct answer: d
    The first input statement reads STORE and SALES and holds the record. Month is initialized to 0. The DO loop executes while SALES is not missing. Inside the loop, month increments, an observation is written to output, the next SALES value is read, and the record is held. The loop stops when a missing value of SALES is read. Control returns to the top of the DATA step, the held record is released, and the input statement reads the next record.
  10. Correct answer: c
    This DATA step produces one observation for each repeating field. The MISSOVER option in the INFILE statement prevents SAS from reading the next record when missing values occur at the end of a record. Every observation contains one value for Flavor, paired with the corresponding value for ID. Because there are 12 values for Flavor, there are 12 observations in the data set.
Last updated: January 10, 2018
..................Content has been hidden....................

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