Subsetting Data By Using Correlated Subqueries
Overview
Correlated subqueries cannot be evaluated independently,
but depend on the values passed to them by the outer query for their
results. Correlated subqueries are evaluated for each row in the outer
query and therefore tend to require more processing time than noncorrelated
subqueries.
Note: Usually, a PROC SQL join
is a more efficient alternative to a correlated subquery. You should
already be familiar with basic PROC SQL joins.
Example
Consider an example of a PROC SQL query that contains a correlated subquery. The following query displays the names of all navigators who are also managers. The WHERE clause in the subquery lists the column Staffmaster.EmpID. The outer query must pass ...
Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.