Quiz

Select the best answer for each question. After completing the quiz, check your answers using the answer key in the appendix.
  1. A Cartesian product is returned when
    1. join conditions are not specified in a PROC SQL join.
    2. join conditions are not specified in a PROC SQL set operation.
    3. more than two tables are specified in a PROC SQL join.
    4. the keyword ALL is used with the OUTER UNION operator.
  2. Given the PROC SQL query and tables shown below, which output is generated?
    proc sql;
       select *
          from store1, 
          store2
          where store1.wk=
                store2.wk;
    Store 1 and Store 2 Tables
    1. PROC SQL Query Output, Answer A
    2. PROC SQL Query Output, Answer B
    3. PROC SQL Query Output, Answer C
    4. PROC SQL Query Output, Answer D
  3. Given the PROC SQL query and tables shown below, which output is generated?
    proc sql;
       select s.*, bonus
          from bonus as b 
          right join
          salary as s
          on b.id=
             s.id;
    Bonus and Salary Tables
    1. PROC SQL Query Output, Answer A
    2. PROC SQL Query Output, Answer B
    3. PROC SQL Query Output, Answer C
    4. PROC SQL Query Output, Answer D
  4. Which PROC SQL query produces the same output as the query shown here?
    proc sql;
       select a.*,
              duration
          from groupa as a,
               groupb as b
          where a.obs=b.obs;
    Note: Assume that the table Groupa contains the columns Obs and Med. Groupb contains the columns Obs and Duration.
    1. proc sql;
         select a.obs label='Obs',
                med 
                b.obs label='Obs',
                duration
            from groupa as a, groupb as b
            where a.obs=b.obs;
    2. proc sql;
         select coalesce(a.obs, b.obs)
                label='Obs', med, duration
            from groupa as a
            full join 
            groupb as b
            on a.obs=b.obs;
    3. proc sql;
         select a.*, duration
            from groupa as a
            left join
            groupb as b
            where a.obs=b.obs;
    4. proc sql;
         select a.*, duration
            from groupa as a
            inner join
            groupb as b
            on a.obs=b.obs;
  5. Which output is generated by the following PROC SQL query?
    proc sql;
       select *
          from table1 
          left join
          table2
    	         on table1.g3=
    	            table2.g3;
    Table 1 and Table 2
    1. PROC SQL Query Output, Answer A
    2. PROC SQL Query Output, Answer B
    3. PROC SQL Query Output, Answer C
    4. PROC SQL Query Output, Answer D
  6. In order for PROC SQL to perform an inner join,
    1. the tables being joined must contain the same number of columns.
    2. the tables must be sorted before they are joined.
    3. the columns that are specified in a join condition in the WHERE clause must have the same data type.
    4. the columns that are specified in a join condition in the WHERE clause must have the same name.
  7. Which statement about in-line views is false?
    1. Once defined, an in-line view can be referenced in any PROC SQL query in the current SAS session.
    2. An in-line view can be assigned a table alias but not a permanent name.
    3. In-line views can be combined with tables in PROC SQL joins.
    4. This PROC SQL query contains an in-line view that uses valid syntax:
      proc sql;
         select name, numvisits
            from (select name, sum(checkin) 
                 as numvisits
                    from facility as f, members as m
                    where area='POOL' and
                          f.id=m.id
                    group by name)
            where numvisits<=10
            order by 1;
  8. Which PROC SQL query generates the same output as the DATA step match-merge and PRINT step shown below?
    data merged;
       merge table1 table2;
       by g3;
    run;
    
    proc print data=merged 
         noobs;
       title 'Merged';
    run;
    Table1, Table2, and Merged Table Output
    1. proc sql;
      title 'Merged';
         select a.g3, z, r
            from table1 as a
            full join
            table2 as b
            on a.g3 = b.g3
            order by 1;
    2. proc sql;
      title 'Merged';
         select a.g3, z, r
            from table1 as a
            table2 as b
            on a.g3 = b.g3
            order by 1;
    3. proc sql;
      title 'Merged';
         select coalesce(a.g3, b.g3)
                label='G3', z, r
            from table1 as a
            full join
            table2 as b
            on a.g3 = b.g3
            order by 1;
    4. proc sql;
      title 'Merged';
         select g3, z, r
            from table1 as a
            full join
            table2 as b
            on a.g3 = b.g3
            order by 1;
  9. A PROC SQL inner join can combine
    1. a maximum of 2 tables or in-line views, but multiple joins can be chained together.
    2. a maximum of 256 tables or 2 in-line views.
    3. a maximum of 256 tables, which includes any tables referenced by an in-line view.
    4. a maximum of 2 tables and 32 columns.
  10. Which statement about the use of table aliases is false?
    1. Table aliases must be used when referencing identical table names from different libraries.
    2. Table aliases can be referenced by using the keyword AS.
    3. Table aliases (or full table names) must be used when referencing a column name that is the same in two or more tables.
    4. Table aliases must be used when using summary functions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.34.80