I've just started preparing for the SAS Advanced Certification and come through the first chapter of the SAS Prep Guide. Below is one of the chapter 1 quizzes and I sort of disagree with the answer given in the book. I picked 'd' because all columns are table-unique except for 'Address', so there is no ambiguous reference if we use 'price.address' to read column 'Address'. To make sure, I tried running the code on some other databases and results are the same for 'b' and 'd', no errors were found.
Does anybody have any ideas on the choice of a correct answer to this question? Thanks.
Thong
Complete the following PROC SQL query to select the columns Address and SqFeet from the table List.Size and to select Price from the table List.Price. (Only the Address column appears in both tables.)
proc sql; _______________ where size.address =price.address; from list.size,list.price;
The SELECT clause lists the columns from both tables to be queried. You must use a prefix with the Address column because it appears in both tables. The prefix specifies the table from which you want the column to be read.
Are you sure about the SQL step code? The semi-colon after the WHERE clause will cause the FROM to be separated from the WHERE.
Answer d is 'either b or c' but c is impossible, because there is no table price. So d is not the right one.
Answer a is incorrect, because address exists on two tables, so the selection is not unique.
We are left with b.
Message was edited by: Dorota Jarosz Oops! Table price does exist. Sorry.
If we can assume that the SQL step was actually stated something like:
proc sql; _______________
from list.size,list.price
where size.address =price.address;
I would have also selected D.
Art: You are right, I misread the problem. Table price does exist. In this case b and c are equivalent, so d is the correct answer.
Am I missing something here? "
Address and SqFeet from the table List.Size", while c: select price.address,sqfeet,price
So that would leave 'b' as only correct answer?
Haikuo
Yes, I am aware of that. However, from I can see from your problem request, let me repeat:
select the columns Address and SqFeet from the table List.Size
So even table 'price' does have included variable 'address', but to comply with the request, variable 'address' has to be from table 'size', therefore 'c' is NOT correct.
Still Confused.
Haikuo
It think literally it does not force you to use 'Size' table to reference to the 'Address' column in the SELECT clause .
What a muddle!
I think you're all correct, but in different ways. I do agree that b and c are equivalent, but only because of the WHERE clause. Because the question lists b as the right answer, and the justification is the need to distinguish address because it is in both tables, I'm speculating that the sample SQL statement was pulled in from a different question, and the person drafting the question didn't pay attention to the WHERE clause.
Because the question specifically requests ADDRESS from SIZE, I think that's what they wanted.
Clearly, either the question or the proposed answer needs to be reworked.
Tom
Further, just because two columns have the same name on different tables it doesn't necessarily mean they hold the same data. E.g., one Address might be a contact address, and the other Address might be an invoice address, so it would be important to follow the spec (or question in this case) to ensure the correct column / data is used.
Regards,
Amir.
It is a thin line: what they WANT versus what gives a correct outcome. They stated:
"...to select the columns Address and SqFeet from the table List.Size and to select Price from the table List.Price."
Maybe they subscribe to the "do always what your boss wants and how he wants it" philosophy? If this is so, I would not like to work for them.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: