SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Quiz: Reading Free-Format Data

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

  1. The raw data file referenced by the fileref Students contains data that is

    Raw Data File: Students
    1---+----10---+----20---+
    FRED JOHNSON 18 USC 1
    ASHLEY FERRIS 20 NCSU 3
    BETH ROSEMONT 21 UNC 4

     a.   arranged in fixed fields
     b.   free-format
     c.   mixed-format
     d.   arranged in columns

  2. Which input style should be used to read the values in the raw data file referenced by the fileref Students?

    Raw Data File: Students
    1---+----10---+----20---+
    FRED JOHNSON 18 USC 1
    ASHLEY FERRIS 20 NCSU 3
    BETH ROSEMONT 21 UNC 4

     a.   column
     b.   formatted
     c.   list
     d.   mixed

  3. Which of the following is not a restriction when using list input?

     a.   Data must be in standard numeric or character format.
     b.   Missing values, regardless of type, must be represented by a period.
     c.   Column location of data must be specified.
     d.   Fields must be read in order, left to right.

  4. Which SAS statement reads the raw data values in order and assigns them to the variables shown below?

    Variables: FirstName (character), LastName (character), Age (numeric), School (character), Class (numeric)

    Raw Data File: Students
    1---+----10---+----20---+
    FRED JOHNSON 18 USC 1
    ASHLEY FERRIS 20 NCSU 3
    BETH ROSEMONT 21 UNC 4

     a.  
    input FirstName $ LastName $ Age School $ Class;
     
     b.  
    input FirstName LastName Age School Class;
     
     c.  
    input FirstName $ 1-4 LastName $ 6-12 Age 14-15
          School $ 17-19 Class 21;
     
     d.  
    input FirstName 1-4 LastName 6-12 Age 14-15
          School 17-19 Class 21;                    

  5. Which SAS statement should be used to read the raw data file referenced by the fileref Salesrep?

    Raw Data File: Salesrep
    1---+----10---+----20---+----30
    ELAINE:FRIEDMAN:WILMINGTON:2102
    JIM:LLOYD:20:RALEIGH:38392
    JENNIFER:WU:21:GREENSBORO:1436

     a.  
    infile salesrep; 
     b.  
    infile salesrep ':'; 
     c.  
    infile salesrep dlm; 
     d.  
    infile salesrep dlm=':'; 

  6. Which of the following raw data files can be read using the MISSOVER option in the INFILE statement? Missing values are indicated with teal-colored blocks.

     a.  
    1---+----10---+----20---+----
    ORANGE SUNNYDALE 20 10
    PINEAPPLE ALOHA 7 10
    GRAPE FARMFRESH 3   
    APPLE FARMFRESH 16 5
    GRAPEFRUIT SUNNYDALE 12 8


     b.  
    1---+----10---+----20---+----
    ORANGE SUNNYDALE 20 10
    PINEAPPLE ALOHA 7 10
    GRAPE FARMFRESH    17
    APPLE FARMFRESH 16 5
    GRAPEFRUIT SUNNYDALE 12 8


     c.  
    1---+----10---+----20---+----
    ORANGE SUNNYDALE 20 10
    PINEAPPLE ALOHA 7 10
    GRAPE           3 17
    APPLE FARMFRESH 16 5
    GRAPEFRUIT SUNNYDALE 12 8


     d.  
    1---+----10---+----20---+----
    ORANGE SUNNYDALE 20 10
    PINEAPPLE ALOHA 7 10
          FARMFRESH 3
    APPLE FARMFRESH 16 5
    GRAPEFRUIT SUNNYDALE 12 8

  7. Which SAS program correctly reads the data in the raw data file referenced by the fileref Volunteer?

    Raw Data File: Volunteer
    1---+----10---+----20---+----30
    ARLENE BIGGERSTAFF 19 UNC 2
    JOSEPH CONSTANTINO 21 CLEM 2
    MARTIN FIELDS 18 UNCG 1

     a.  
    data perm.contest;
       infile volunteer;
       input FirstName $ LastName $ Age School $ Class;
    run;
     
                         
     b.  
     data perm.contest;
        infile volunteer;
        length LastName $ 11;
        input FirstName $ LastName $ Age School $ Class;
    run;  
    
                         
     c.  
     data perm.contest;
        infile volunteer;
        input FirstName $ LastName $ Age School $ Class;
        length LastName $ 11;
    run; 
    
                          
     d.  
     data perm.contest;
        infile volunteer;
        input FirstName $ LastName $ 11. Age School $ Class;
    run;  

  8. What type of input should be used to read the values in the raw data file referenced by the fileref Enrolled?

    Raw Data File: Enrolled
    1---+----10---+----20---+----30
    UNC ASHEVILLE 2,712
    UNC CHAPEL HILL 24,189
    UNC CHARLOTTE 15,031
    UNC GREENSBORO 12,323

     a.   column
     b.   formatted
     c.   list
     d.   modified list

  9. Which SAS statement correctly reads the values for Flavor and Quantity? Make sure the length of each variable can accommodate the values shown.

    Raw Data File Cookies
    1---+----10---+----20---+----30
    CHOCOLATE CHIP  10,453
    OATMEAL  12,187
    PEANUT BUTTER  11,546
    SUGAR  12,331   

     a.  
    input Flavor & $9. Quantity : comma.; 
     b.  
    input Flavor & $14. Quantity : comma.;
     c.  
    input Flavor : $14. Quantity & comma.;
     d.  
    input Flavor $14. Quantity : comma.;

  10. Which SAS statement correctly reads the raw data values in order and assigns them to these corresponding variables: YearFounded (numeric), School (character), Enrolled (numeric)?

    Raw Data File: Founding
    1---+----10---+----20---+----30---+----40
    1868 U OF CALIFORNIA BERKELEY  31,612
    1906 U OF CALIFORNIA DAVIS  21,838
    1965 U OF CALIFORNIA IRVINE  15,874
    1919 U OF CALIFORNIA LOS ANGELES  35,730 

     a.  
    input YearFounded School & $27.
          Enrolled : comma.;
     
     b.  
    input YearFounded 1-4 School & $27.
          Enrolled : comma.;
     
     c.  
    input @1 YearFounded 4. +1 School & $27.
          Enrolled : comma.;
     
     d.   all of the above



back||next

Terms of Use & Legal Information | Privacy Statement