{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw5solSTAT475F11

# hw5solSTAT475F11 - STAT 475 HOMEWORK 5 SOLUTION Chapter 3...

This preview shows pages 1–3. Sign up to view the full content.

STAT 475 HOMEWORK 5 SOLUTION Chapter 3 Quiz Question 1 A is the correct answer. A Cartesian product is constructed when join conditions are not specified in a PROC SQL join. In this case, every row from the first table is combined with each row from the second table since in the absence of a join condition, PROC SQL does not have any rules for how to combine the tables in any other way. B – is not correct since join conditions are specified in the PROC SQL join not in a PROC SQL set operation. C – is not correct since the presence of more than two tables is irrelevant. A PROC SQL join simply specifies the rules for how the data should be combined. If these rules are not given, all rows are combined with all rows, in the form of a cross product. D – is not correct since it is not true that the inclusion of the keyword ALL with the OUTER UNION operator causes PROC SQL to return a cartesian product. Question 2 B is the correct answer. In this PROC SQL inner join query, the rows from the first table that match rows from the second table are combined, based on the matching criteria specified in the WHERE clause. Columns are not overlaid, so all columns from the referenced tables (including any columns with duplicate names) are displayed. Any unmatched rows from either table are not displayed. A – is not correct since the column WK from the second table should not have the value 5 for WK and \$43 for Sales. In this inner join, the only values 1, 2, 3, 4 for WK match. C – is not correct since the values for the second table are not printed in the output. D – is not correct since the values for the second table are listed in a second column not linearly after the values of the first table. Question 3 D is the correct answer. Notice that in this query, we have a “right join”. Therefore, this PROC SQL query is a right outer join, which retrieves all rows that match across tables, based on the join conditions in the ON clause, plus nonmatching rows from the right (second) table. A – is not correct since the value for cell (3,3) for the output should be missing. B – is not correct since the value for cell (3,2) for the output should be 55000, not missing. C – is not correct since the last value for ID in cell (3,1) should be 978 and the value of cell number (3,3) should be missing, not 3500. Question 4 D is the correct answer. There are two valid formats for writing a PROC SQL inner join. The PROC SQL query shown at the top of this question uses the first inner join format, which does 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
not use a keyword to indicate the type of join. The alternate format is similar to an outer join and uses the keyword INNER JOIN. A – is not correct since among other things, the “label=’Obs’” does not belong to the select statement and will generate an error.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}