Chapter Contents

Previous

Next
SAS SQL Query Window User's Guide

Query Window Menus

The SQL Query Window has File, Tools, View, and Profile pull-down menus (PMENUs).

If your monitor supports the use of a mouse, you can also display the most frequently used Tools and View items from the pop-up menu. Press the right-most mouse button on UNIX, OS/2, and Windows, or the option key and the mouse button on the Macintosh. Some items in a menu may be "greyed out," which means that they cannot be selected until you have performed some other action.

If three periods follow a menu item, another window will appear if you select the item. If an arrow (→) follows a menu item, another menu will appear if you select the item.

Only SQL Query Window-specific menu items are discussed here. For SAS menu items, see your SAS System documentation.


File PMENU


Save Query

Save Query displays a menu from which you can select these options:

Save as QUERY to include later
saves your query as a .QUERY catalog entry. You can include the saved query during your current SQL Query Window session or during a later session. Other users who have access to the catalog in which the query is stored can also include the query in their sessions.

Save as SOURCE entry
saves your query as a .SOURCE catalog entry. A query that is saved as a .SOURCE entry can be used in SAS/AF and SAS/EIS applications, and it can be included in the PROGRAM EDITOR, but it cannot be included in the SQL Query Window.

Save as External file...
saves your query as a PROC SQL statement in an external file.

The query is stored on the local host even if you are connected to a remote session through SAS/CONNECT software.

List/Include Saved Queries...

List/Include Saved Queries... displays a list of the queries that you have previously saved in the profile catalog with which the Query Window was invoked. You can also display a list of queries that were saved in other catalogs. If the Query Window was invoked without a profile, the default profile catalog is SASUSER.PROFILE.

Create Table from Query Results...

Create Table from Query Results... enables you to create a PROC SQL table, which is a SAS data file, and to save the results of your query into it. If SAS/CONNECT software is licensed at your site and you select this item when you are connected to a remote session, you can choose to download the results of your query into a local SAS data file, or create the table on the remote side.

Create View of Query...

Create View of Query enables you to create a PROC SQL view that contains the SQL syntax of your query. The PROC SQL view can be read by any SAS procedure as if the view were a SAS data file. When you specify the view in a PROC or DATA step, the query is processed and returns current data from the queried table(s) to your report. If SAS/CONNECT software is licensed at your site and you select this item when you are connected to a remote session, the view will be created on the remote side.


View PMENU


Columns...

Columns... enables you to:


Where Conditions for Subset...

Where Conditions for Subset... enables you to use a Where expression to read a subset of the data in a table or tables by specifying the conditions that the selected data must meet.

Distinct

Distinct removes duplicate rows from your query output.

Order By...

Order By... enables you to select columns or column expressions to specify the order by which you want the output sorted.

Group(s) for Summary Functions...

Group(s) for Summary Functions... enables you to specify groups of column values to which a function is to be applied.

Having Condition for Group...

Having Condition for Group... enables you to build or modify a Having expression. A Having expression specifies a condition (or conditions) for each group that is included in the query. You specify the group in a Group By clause. If no Group By clause is specified, the rows in a table or a subset of the table are evaluated as one group.

Tables...

Tables... enables you to select the table(s) from which you want to retrieve data. This is the first step in the query-building process. If you have already started building your query, use the Tables... item to:


Join Type...

Join Type... enables you to use inner joins or outer joins to join tables when you have selected two tables for the query.


Tools PMENU


Run Query

Run Query displays a menu from which you can select these options:

Run Immediate
immediately submits the query to the SQL procedure for processing. The output is sent to the SAS Display Manager OUTPUT window. If SAS/CONNECT software is licensed at your site and you select this item when you are connected to a remote session, the query is submitted to the remote session for processing.

Design a Report
uses PROC REPORT to design a report for your query output. Another menu appears with the following options:

Begin with default report...
invokes PROC REPORT with the default settings for the query. You can then design a report within PROC REPORT.

Name a predefined report...
lists any report definitions that have been stored in the catalog from which you invoked your SQL Query Window session or in other catalogs.

Use definition from last report
invokes PROC REPORT and uses the report definition that you designed when you selected Design a Report for your current query.


Show Query...

Show Query displays the PROC SQL syntax of your query. You can choose this item at any time during the query-building process.

Preview Window...

Preview Window... displays your query in a PREVIEW window. You can edit the query syntax in this window and save it to a file. Changes that you make in the PREVIEW window are not carried over to the current query in the SQL Query Window.

Switch Access Mode

Switch Access Mode enables you to specify whether you are going to query SAS data sets (including SAS data files and SAS data views) or tables from a database management system. You can change the access mode at any time during an SQL Query Window session. Changing access modes resets the query and displays the tables that are available for that access mode.

Depending upon your operating system and the SAS/ACCESS products that have been installed at your site, you can select one of the following access modes:


Switch to New Profile

Switch to New Profile resets the query and enables you to change to a profile that was previously created and stored.

Reset

Reset deletes your current query from the Query Window and returns you to the Tables window to begin a new query.

Report Options...

Report Options... enables you to specify the beginning page number, title, and subtitles for the report.


Profile PMENU


Set Preferences...

Set Preferences... enables you to create a profile entry.

Show Current Preferences...

Show Current Preferences... displays the preference settings that are in effect for your current SQL Query Window session.

Update Preferences...

Update Preferences... enables you to update the preference settings for any SQL Query Window profile.


Pop-up Menu

Many of the PMENU items can also be selected from the pop-up menu:

[IMAGE]

See Query Window Menus for the ways in which you can invoke the pop-up menu.


Chapter Contents

Previous

Next

Top of Page

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