Chapter 6: Creating SAS Data Sets from External Files

  1. Correct answer: a
    You assign a fileref by using a FILENAME statement in the same way that you assign a libref by using a LIBNAME statement.
  2. Correct answer: d
    Like LIBNAME statements, FILENAME statements are global; they remain in effect until changed or canceled, or until the SAS session ends.
  3. Correct answer: b
    You use an INFILE statement to specify the raw data file to be read. You can specify a fileref or an actual filename (in quotation marks). The OBS= option in the INFILE statement enables you to process only records 1 through n.
  4. Correct answer: d
    The keyword _NULL_ in the DATA statement enables you to use the power of the DATA step without actually creating a SAS data set. You use FILE and PUT statements to write observations from a SAS data set to a raw data file. The FILE statement specifies the raw data file, and the PUT statement describes the lines to write to the raw data file. The filename and location that are specified in the FILE statement must be enclosed in quotation marks.
  5. Correct answer: b
    Column input is appropriate only in some situations. When you use column input, your data must be standard character or numeric values, and they must be in fixed fields. That is, values for a particular variable must be in the same location in all records.
  6. Correct answer: a
    The INPUT statement creates a variable using the name that you assign to each field. Therefore, when you write an INPUT statement, you need to specify the variable names exactly as you want them to appear in the SAS data set.
  7. Correct answer: b
    You can use column input to read fields in any order. You must specify the variable name, identify character variables with a $, and specify the correct starting and ending column for each field.
  8. Correct answer: c
    To redefine the values of the variable Income in an assignment statement, you specify the variable name on the left side of the equal sign and an appropriate expression including the variable name on the right side of the equal sign.
  9. Correct answer: d
    To read instream data, you specify a DATALINES statement and data lines, followed by a null statement (single semicolon) to indicate the end of the input data. Program a. contains no DATALINES statement, and the INPUT statement does not specify the fields to read. Program b. contains no data lines, and the INPUT statement in Program c. does not specify the necessary dollar signs for the character variables Country and Vehicle.
  10. Correct answer: c
    To subset data, you can use a subsetting IF statement in any DATA step to process only those observations that meet a specified condition. Because Sex is a character variable, the value F must be enclosed in quotation marks and must be in the same case as 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
18.226.34.25