Adding a Data Source to a Query

Adding a Table

To add a table to a query, use the SAS Folders tree to locate the table (Metadata Table) and then drag and drop the table onto the workspace.
Tip
You can also click Search and search for the table by name and location.

Adding a Subquery

After you have designed a query and saved it, it can be used as an input data source to a new query. To add a subquery to a query, use the SAS Folders tree to locate the query (Visual Data Query) and then drag and drop the query onto the workspace.
The subquery is represented on the workspace by the structure of the output table.

Best Practices for Adding Data Sources

When you plan to join data sources (tables or queries), the order in which you add the data sources to the workspace matters. The first data source that is added to the workspace is automatically assigned as the left table for any joins that you add to the query.
If you are designing a query that uses a fact and dimension tables, drop the fact table onto the workspace first. You can perform left, right, or full joins with the dimension tables faster because you need to specify the join type only. However, if you place a dimension table first, you can easily use the Swap button to switch the left and right tables in the join.
If you are not working with fact and dimension tables, then the sequence for adding tables to the workspace might not be very important. Just remember that the first table dropped onto the workspace is assigned as the left table and that you can swap the left and right tables on the Joins tab.

Best Practices for Input Libraries

A query can use a single input library only. This enables SAS Visual Data Builder to take advantage of vendor-specific features in SQL processing. If the input tables are from a third-party vendor database, the SAS/ACCESS Interface engine can optimize the performance of the query by passing the SQL statements through to the database.
When you use a subquery as a data source, remember that you can join input tables to the subquery only when the subquery output table uses the same library.