Combining SAS Data Sets



Select the best answer for each question. When you are finished, click Submit Quiz.

  1. Which statement is true concerning match-merging?



  2. Which of the following data set options can be added to the MERGE statement to help identify data set contributors (that is, identify the matches)?



  3. If you execute the following DATA step, which observations does the data set bonuses contain?

    data bonuses;
       merge managers(in=M) 
             staff(in=S);
       by EmpID;
       if M=0 and S=1;
    run;;



  4. Which subsetting IF statement selects observations for subsequent processing only if all three input data sets contribute to the current observation?

    data merged.flowers;
       merge spring.roses(rename=(red=BrickRed) in=yellow)
             spring.lilacs(in=purple)
             spring.petunias(in=pink);
       by ID;
       _________________________
    run;



  5. The following program will execute without errors:

    data work.merged;
       merge blood.donors1 blood.donors2;
       by ID;
    run;

    blood.donors1
    ID Type Units
    2304 O 16
    1129 A 48
    1129 A 50
    1129 A 57
    2486 B 63
    blood.donors2
    ID Code Units
    6488 65 27
    1129 63 32
    5438 62 39
    2304 61 45
    1387 64 67



  6. Can these three data sets be merged in one DATA step?

    a
    Hair
    Makeup
    Nails
    Jewelry
    Shoes
    b
    Bows
    Hairspray
    Hair
    Rubber Bands
    Brush
    c
    Hose
    Socks
    Anklet
    Boots
    Shoes



  7. Which of the following LIBNAME statements correctly assigns the libref MyMusic to the file AllMusic.xls, which is stored in the Entertainment directory of the C: drive on the Windows operating environment?



  8. The data sets ensemble.spring and ensemble.summer both contain a variable named Blue, and Blue is not the BY variable. Which program prevents the values of the variable Blue from being overwritten when you merge the two data sets?



  9. The variable Location appears in the three data sets represented below. Which value appears in the output data set when the three data sets are merged in the order shown?


    merge dataset1 dataset2 dataset3;
    dataset1
    Location
    Florida
    dataset2
    Location
    Canada
    dataset3
    Location
    New York



  10. Suppose the empinfo.bonuses data set contains the variables ID, Name, Office, Manager, Location, and Amount. Specify a data set option in the MERGE statement below to use only the variables ID, Name, and Amount in the data set.

    data mergedata.emppay;
       merge sales.reps(rename=(office=OfficeNumber))
             empinfo.sales
             empinfo.bonuses ___________________;
       by ID;
    run;