SAS Tip: Build a subquery with the SAS Enterprise Guide query builder (Daily tip for 2025-May-13)


SAS Enterprise Guide supports the idea of subqueries, a concept familiar to SQL programmers. With a subquery (sometimes called "subselect" or "inner query"), you can express the entire operation in one SQL step. That's one trip to the database, and only one set of results brought back to SAS.  

 

You accomplish this by using Query Template to define the inner query, then combine it with an expression of the outer query.  For more information, read Building an SQL subquery in SAS Enterprise Guide.

 

qb_innerq.png

 

Thanks to @MichaelB_SAS for the SAS Global Forum paper that supports this tip

READ this complete tip   Visit a random SAS tip

Start a topic
About these Tips
A "SAS tip" is a basic unit of information exchange between SAS users. The tips on this board come from sasCommunity.org, from SAS user conferences, from SAS blogs, and from freelance contributions from SAS users like you. We hope that you're able to always learn something new here!


» How you can contribute


Tip-o-meter: 65 tips

OSZAR »