# Chapter 3. Combining Tables Horizontally Using Proc SQL

10 Questions | Total Attempts: 90  Settings  Practice for the SAS advance certification exam.

• 1.
A Cartesian product is returned when
• A.

Join conditions are not specified in a PROC SQL join.

• B.

Join conditions are not specified in a PROC SQL set operation.

• C.

More than two tables are specified in a PROC SQL join.

• D.

The keyword ALL is used with the OUTER UNION operator.

• 2.
Given the PROC SQL query and tables shown below, which output is generated?
• A.
• B.
• C.
• D.
• 3.
Given the PROC SQL query and tables shown below, which output is generated?
• A.
• B.
• C.
• 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. Δ
• A.

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;

• B.

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;

• C.

proc sql; select a.*, duration from groupa as a left join groupb as b where a.obs=b.obs;

• D.

proc sql; select a.*, duration from groupa as a inner join groupb as b on a.obs=b.obs;

• 5.
Which output will the following PROC SQL query generate?
• A.
• B.
• C.
• D.
• 6.
In order for PROC SQL to perform an inner join,
• A.

The tables being joined must contain the same number of columns.

• B.

The tables must be sorted before they are joined.

• C.

The columns that are specified in a join condition in the WHERE clause must have the same data type.

• D.

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?
• A.

Once defined, an in-line view can be referenced in any PROC SQL query in the current SAS session.

• B.

An in-line view can be assigned a table alias but not a permanent name.

• C.

In-line views can be combined with tables in PROC SQL joins.

• D.

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 will generate the same output as the DATA step match-merge and PRINT step shown below?
• A.

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;

• B.

proc sql; title 'Merged'; select a.g3, z, r from table1 as a full join corr table2 as b on a.g3 = b.g3 order by 1;

• C.

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;

• D.

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
• A.

A maximum of two tables or in-line views, but multiple joins can be chained together.

• B.

A maximum of 32 tables or two in-line views.

• C.

A maximum of 32 tables, which includes any tables referenced by an in-line view.

• D.

A maximum of two tables and 32 columns.

• 10.
Which statement about the use of table aliases is false?
• A.

Table aliases must be used when referencing identical table names from different libraries.

• B.

Table aliases can be referenced by using the keyword AS.

• C.

Table aliases (or full table names) must be used when referencing a column name that is the same in two or more tables.

• D.

Table aliases must be used when using summary functions.

Related Topics Back to top