Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The Data Table

Using the Query Window

You can use the Query window to reduce the number of variables that you load into the data table. You can also use the Query window to bring more than one data set into the data table, as well as write SQL queries to filter the data.

Opening a New Query

You can use the Query window to bring selected columns of data from one or more SAS data sets into the data table. The Query window opens a view of the data set that cannot be edited. You can, however, save the view as a SAS data set that you can edit. To save the view as a SAS data set, select File arrow Save As By SAS Name ...

Select File arrow Open With New Query ... to open the SQL QUERY TABLES window. Select one or more tables to use in your query and click on the right arrow.

c0209.gif (11144 bytes)

Figure 2.9: SQL QUERY TABLES Window

Click OK to display the SQL QUERY COLUMNS window. Select the columns that you want to include in the query and click on the right arrow.

c0210.gif (11250 bytes)

Figure 2.10: SQL QUERY COLUMNS Window

Select File arrow Close to exit the Query window and open the data view into the Analyst data table.

The query is added as a node to your project tree, and the selected columns are brought into the data table. The name of the query node is generated by Analyst in the form QUERYnnnn.

Caution: If you select the Analyst window while in the Query window, the resulting query is not returned to Analyst.

Saving and Opening an Existing Query

Once you have used the Query window to create views of SAS data, you can bring these views into Analyst.

To create a query to use later, prepare your query in the Query window, and select File arrow Save Query arrow Save as QUERY to Include later in the SQL QUERY COLUMNS window. Select the SAS library, catalog, and library member name.

To open a saved query in Analyst, select File arrow Open With Existing Query ... The Open with Existing Query window searches for saved queries in all available SAS libraries.

c0211.gif (4520 bytes)

Figure 2.11: Open with Existing Query Window

You can also use the Query window to apply an SQL query to your data. Refer to the Query window documentation for more information.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.