Why does the PROC PRINT call with the following WHERE clause produce no observations? PROC PRINT DATA=work.salaries; WHERE salary GT 20000; RUN;

Prepare for the SAS Base Programming Certification. Practice with multiple choice questions and receive instant feedback. Strengthen your knowledge and be ready to excel in your exam!

Multiple Choice

Why does the PROC PRINT call with the following WHERE clause produce no observations? PROC PRINT DATA=work.salaries; WHERE salary GT 20000; RUN;

Explanation:
The statement that the WHERE clause in the PROC PRINT call produces no observations is correct because WHERE statements do not automatically convert data types. If the variable "salary" is stored as a character type instead of a numeric type, the condition "salary GT 20000" will not be able to evaluate correctly. Since the comparison requires both operands to be of compatible types, having a character variable and a numeric constant leads to the WHERE clause being unable to process the comparison, resulting in zero observations being printed. The other options encompass misunderstandings about SAS functionality. The symbol "GT" is a recognized operator within the SAS language, so the statement about it being invalid is not accurate. Similarly, the WHERE clause does not require the literal value to be formatted with a comma, as SAS can handle numeric comparisons without any formatting unless specifically required for output display. Thus, the issue here is rooted in the type incompatibility that arises when trying to compare character data with a numeric value.

The statement that the WHERE clause in the PROC PRINT call produces no observations is correct because WHERE statements do not automatically convert data types. If the variable "salary" is stored as a character type instead of a numeric type, the condition "salary GT 20000" will not be able to evaluate correctly. Since the comparison requires both operands to be of compatible types, having a character variable and a numeric constant leads to the WHERE clause being unable to process the comparison, resulting in zero observations being printed.

The other options encompass misunderstandings about SAS functionality. The symbol "GT" is a recognized operator within the SAS language, so the statement about it being invalid is not accurate. Similarly, the WHERE clause does not require the literal value to be formatted with a comma, as SAS can handle numeric comparisons without any formatting unless specifically required for output display. Thus, the issue here is rooted in the type incompatibility that arises when trying to compare character data with a numeric value.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy