SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Quiz: Creating a Single Observation from Multiple Records

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

  1. You can position the input pointer on a specific record using

     a.   column pointer controls.
     b.   column specifications.
     c.   line pointer controls.
     d.   line hold specifiers.

  2. Which pointer control is used to read multiple records in sequential order?

     a.   @n
     b.   #n
     c.   +n
     d.   /

  3. Which pointer control can be used to read records in any order?

     a.   @n
     b.   #n
     c.   +n
     d.   /

  4. Which SAS statement correctly reads the values for FirstName, LastName, Address, City, State, and Zip in order?

    1---+----10---+----20---
    LAWRENCE CALDWELL 
    1010 LAKE STREET 
    ANAHEIM CA 94122 
    RACHEL CHEVONT 
    3719 OLIVE VIEW ROAD 
    HARTFORD CT 06183 

     a.  
    input FirstName $ LastName $ /
          Address $20. /
          City $ +1 State $2. +1 Zip $5.;
           
     b.  
    input FirstName $ LastName $ /;
          Address $20. /;
          City $ +1 State $2. +1 Zip $5.;
            
     c.  
    input / FirstName $ LastName $
          / Address $20.
          City $ +1 State $2. +1 Zip $5.;
            
     d.  
    input / FirstName $ LastName $;
          / Address $20.;
          City $ +1 State $2. +1 Zip $5.;
    
                       

  5. Which INPUT statement correctly reads the values for PatientID in the fourth record, then returns to the first record to read the values for FirstName and LastName?

    1---+----10---+----20---
    GEORGE CHESSON 
    3801 WOODSIDE COURT 
    GARNER NC 27529 
    XM065 FLOYD 
    JAMES COLDWELL 
    123-A TARBERT  
    APEX NC 27529 
    XMO65 LAWSON 

     a.  
    input #4 PatientID $5.
          #1 FirstName $ LastName $;
                        
     b.  
    input #4 PatientID $ 1-5
          #1 FirstName $ LastName $;
                        
     c.  
    input #4 PatientID $
          #1 FirstName $ LastName $;
                        
     d.   both a and b

  6. How many records will be read for each execution of the DATA step?

    1---+----10---+----20---
    SKIRT BLACK 
    COTTON 
    036499 $44.98 
    SKIRT NAVY 
    LINEN 
    036899 $51.50 
    DRESS RED 
    SILK
    037299 $76.98 
     data spring.sportswear;
        infile newitems;
        input #1 Item $ color $
              #3 @8 Price comma6.
              #2 Fabric $
              #3 SKU $ 1-6;
    run; 
                 

     a.   one
     b.   two
     c.   three
     d.   four

  7. Which INPUT statement correctly reads the values for City, State, and Zip?

    1---+----10---+----20---
    DINA  FIELDS 
    904  MAPLE  CIRCLE  
    DURHAM  NC  27713 
    ELIZABETH  GARRISON 
    1293  OAK  AVENUE
    CHAPEL  HILL  NC  27614
    DAVID  HARRINGTON  

    2426  ELMWOOD  LANE 

    RALEIGH  NC  27803

     a.  
    input #3 City $ State $ Zip $; 
     b.  
    input #3 City & $11. State $ Zip $;
     c.  
    input #3 City $11. +2 State $2. + 2 Zip $5.;
     d.   all of the above

  8. Which program does not read the values in the first record as a variable named Item and the values in the second record as two variables named Inventory and Type?

    1---+----10---+----20---
    COLORED PENCILS 
    12 BOXES 
    WATERCOLOR PAINT 
    8 PALETTES 
    DRAWING PAPER 
    15 PADS  

     a.  
    data perm.artsupplies;
       infile instock;
       input Item & $16. /
             Inventory 2. +1 Type $8.;
    run;
                         
     b.  
    data perm.artsupplies;
        infile instock;
        input Item & $16.
              / Inventory  2. +1 Type $8.;
    run;
                       
     c.  
    data perm.artsupplies;
       infile instock;
       input #1 Item & $16.
             Inventory 2. +1 Type $8.;
    run;
                        
     d.  
    data perm.artsupplies;
       infile instock;
       input Item & $16.
             #2 Inventory 2. +1 Type $8.;
    run;
    
                       

  9. Which INPUT statement reads the values for LastName, FirstName, Department and Salary (in that order)?

    1---+----10---+----20---
    ABRAMS THOMAS
    SALES $25,209.03
    BARCLAY ROBERT
    MARKETING $29,180.36
    COURTNEY MARK
    PUBLICATIONS $24,006.16

     a.  
    input #1 LastName $ FirstName $ /
          Department $12. Salary comma10.;
    
                       
     b.  
    input #1 LastName $ FirstName $ /
          Department : $12. Salary : comma.;
    
                       
     c.  
    input #1 LastName $ FirstName $
          #2 Department : $12. Salary : comma.;
    
                       
     d.   both b and c

  10. Which raw data file poses potential problems when you are reading multiple records for each observation?

     a.  
    1---+----10---+----20---
    LAWRENCE CALDWELL 
    1010 LAKE STREET  
    ANAHEIM CA 94122  
    RACHEL CHEVONT 
    3719 OLIVE VIEW ROAD 
    HARTFORD CT 06183 


     b.  
    1---+----10---+----20---
    SHIRT LT BLUE SOLID 
    SKU 128699  
    $38.99 
    SHIRT DK BLUE STRIPE
    SKU 128799
    $41.99 


     c.  
    1---+----10---+----20---
    MARCUS JONES
    SR01 $26,134.00 
    MARY ROBERTSON
    COURTNEY NEILS
    TWO1 $28,342.00


     d.  
    1---+----10---+----20---
    CROCUS MIX 
    10 CASES  
    DAFFODIL 
    12 CASES
    HYACINTH BLUE
    8 BAGS



back||next

Terms of Use & Legal Information | Privacy Statement