Many Uses of SQL Subqueries, Part II
This paper acquaints the reader with SQL subqueries, and provides some basic examples of how they might be used.
Subqueries are very useful tools in SQL. A subquery is an embedded query nested within another query. They’re most often used when a particular value that is needed for the outer query is unknown, but can be searched for using an SQL query. This paper is the second in a series about using SQL subqueries in SAS and focuses on using subqueries with CASE/WHEN logic and group functions.
- The Many Uses of SQL Subqueries, Part II, by Tasha Chapman, Oregon Department of Consumer and Business Services
Example SAS code:
Portions of this paper were presented at the Western Users of SAS Software (WUSS) 2011 Conference in San Francisco, California. (Winner - Best Contributed Paper)
Presented at a Puget Sound SAS Users Group meeting.
Presented at a State of Oregon SAS Users Group meeting.
Find more SOSUG presentations, as well as other tips, tricks, and tools created by or recommended by SOSUG members here.