13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

872 Using a Pass-Through Query in a Subquery 4 Chapter 30When a comparison operator such as < or > is used in a WHERE clause, thesubquery must return a single value. In this example, the AVG summary functionreturns the average salary of employees in the department, $57,840.86. This value isinserted in the query, as if the query were written:where dept like &dept and salary < 57840.86;Employees who earn less than the department’s average salary are listed in thefollowing output.Output 30.3Output from a Pass-Through Query in a SubqueryEmployees Who Earn Below the ’ACC%’ Average SalaryEMPID LASTNAME-----------------123456 VARGAS135673 HEMESLY423286 MIFUNE457232 LOVELLIt might appear to be more direct to omit the Pass-Through query and to insteadaccess Samples.AllEmp a second time in the subquery, as if the query were written asfollows:%let dept=’ACC%’;proc sql stimer;select empid, lastnamefrom samples.allempwhere dept like &dept and salary

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!