SAS OnlineTutor HomeFAQ PageSuggested Learning   PathsContents+Searchback||next

Quiz: Reading Raw Data

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

  1. Which SAS statement associates the fileref Crime with the raw data file C:\States\Data\Crime?

     a.  
    filename crime 'c:\states\data\crime';
     b.  
    filename crime c:\states\data\crime; 
     c.  
    fileref crime 'c:\states\data\crime'; 
     d.  
    filename 'c:\states\data\crime' crime; 

  2. Filerefs remain in effect until . . .

     a.   you change them.
     b.   you cancel them.
     c.   you end your SAS session.
     d.   all of the above.

  3. Which statement identifies the name of a raw data file to be read with the fileref Products and specifies that the DATA step read only through record 15?

     a.  
    infile products obs 15;
     b.  
    infile products obs=15;
     c.  
    input products obs=15; 
     d.  
    input products 1-15;

  4. Which INPUT statement below correctly reads raw data with these descriptions?

    Field Name Start Column End Column Data Type
    Brand 1 35 character
    Wear 37 42 numeric

     a.  
    input Brand $ 1-36 Wear 37-42; 
     b.  
    input Brand 1-36 Wear $ 37-42; 
     c.  
    input Brand $ 1-35 Wear 37-42; 
     d.  
    input Brand 1-35 Wear $ 37-42; 

  5. Which of the following is true when using column input?

     a.   You can read the fields in the raw data file in any order.
     b.   You can read any or all fields from the raw data file.
     c.   You can specify only the starting column for values that occupy only one column.
     d.   all of the above.

  6. Which program creates the output shown below?

    1---+----10---+----20---+----30
    3427 Chen    Steve Raleigh    
    1436 Davis   Lee   Greensboro 
    2812 King    Vicky Memphis    
    1653 Sanchez Jack  Austin     


    Obs ID LastName FirstName City
    1 3427 Chen Steve Raleigh
    2 1436 Davis Lee Greensboro
    3 2812 King Vicky Memphis
    4 1653 Sanchez Jack Austin

     a.  
    data work.salesreps;
       infile empdata;
       input ID $ 1-4 LastName $ 6-12
             FirstName $ 14-18 City $ 20-29;
    run;
    proc print data=work.salesreps;
    run; 
     
     b.  
    data work.salesreps;
       infile empdata;
       input ID $ 1-4 LASTNAME $ 6-12
             FIRSTNAME $ 14-18 CITY $ 20-29;
    run;
    proc print data=work.salesreps;
    run; 
     
     c.  
    data work.salesreps;
       infile empdata;
       input id $ 1-4 lastname $ 6-12
             firstname $ 14-18 city $ 20-29;
    run;
    proc print data=work.salesreps;
    run; 
     
     d.   all of the above

  7. Which statement correctly reads the fields in the following order: StockNumber, Price, Item, Finish, Style?

    Field Name Starting Column Ending Column Data Type
    StockNumber 1 3 character
    Finish 5 9 character
    Style 11 18 character
    Item 20 24 character
    Price 27 32 numeric

    1---+----10---+----20---+----30---+
    310 oak   pedestal table  329.99
    311 maple pedestal table  369.99
    312 brass floor    lamp   79.99
    313 glass table    lamp   59.99
    313 oak   rocking  chair  153.99

     a.  
    input StockNumber $ 1-3 Finish $ 5-9 Style $ 11-18
          Item $ 20-24 Price 27-32;              
     
     b.  
    input StockNumber $ 1-3 Price 27-32
          Item $ 20-24 Finish $ 5-9 Style $ 11-18; 
     
     c.  
    input $ StockNumber 1-3 Price 27-32
          $ Item  20-24 $ Finish 5-9 $ Style 11-18; 
     
     d.  
    input StockNumber $ 1-3 Price $ 27-32
          Item $ 20-24 Finish $ 5-9 Style $ 11-18;     

  8. Which raw data file can be read using column input?

     a.  
    1---+----10---+----20---+
    Henderson CA 26 ADM
    Josephs SC 33 SALES
    Williams MN 40 HRD
    Rogan NY RECRTN  
     
     b.  
    1---+----10---+----20---+
    2803 Deborah Campos  173
    2912 Bill    Marin   205
    3015 Helen   Stinson 194
    3122 Nicole  Terry   187 
     
     c.  
    1---+----10---+----20---+
    Avery John 601.23
    Davison Sherrill 723.15
    Holbrook Grace 489.76
    Jansen Mike 638.42
     
     d.   all of the above

  9. What happens when invalid values are encountered in a DATA step?

     a.   A message showing the invalid value appears in the log.
     b.   The DATA step continues to execute.
     c.   The SAS System stops processing the DATA step.
     d.   a and b

  10. Which SAS statement subsets the raw data shown below so that only the observations where Sex (in the second field) has a value of F are processed?

    1---+----10---+----20---+
    Alfred  M 14 69.0 112.5
    Becka   F 13 65.3 98.0 
    Gail    F 14 64.3 90.0 
    Jeffrey M 13 62.5 84.0
    John    M 12 59.0 99.5
    Karen   F 12 56.3 77.0 
    Mary    F 15 66.5 112.0 
    Philip  M 16 72.0 150.0 
    Sandy   F 11 51.3 50.5 
    Tammy   F 14 62.8 102.5 
    William M 15 66.5 112.0  

     a.   if sex=f;
     b.   if sex=F;
     c.   if sex='F';
     d.   a or b



back||next

Terms of Use & Legal Information | Privacy Statement