Chapter Contents |
Previous |
Next |
SAS SQL Query Window User's Guide |
To save the query that you created in the previous example in your SASUSER.PROFILE, select
Tools | Show Query... |
to display the SQL QUERY window.
Saving a Query to Include Later |
Select
Save Query | Save as QUERY to Include later... |
to save your query to SASUSER.PROFILE or another catalog of your choosing.
Type IDWAGE in the
Entry Name
field. Type
ID number and hourly wage
in the description field. Select
OK
to save your query as
an entry in SASUSER.PROFILE and to return to the SQL QUERY window. Select
Goback
to return to the SQL QUERY COLUMNS window.
Saving Several Queries |
You can save more than one query and then select from a list of queries that you have saved in the current Query Window session or in a previous Query Window session.
From the SQL QUERY COLUMNS window, select
View | Tables... |
to return to the SQL QUERY TABLES window.
Remove SAMPLE.WAGE from the list of Selected Tables. Select
OK
to display the SQL QUERY COLUMNS window.
Select
Salary
from the list of Available Columns and add
it to the list of Selected Columns. Select
View | Where Conditions for Subset... |
to display the WHERE EXPRESSION window.
Select
Salary
from the list of Available Columns. Select
GT
(Greater Than) from the list of Operators. Select
<LOOKUP distinct values>
from the list of Available Columns. Select
$25,000
from the Lookup
Values window. Select
OK
to save your WHERE expression.
Select
View | Order By... |
to display the ORDER BY COLUMNS window. Select
Salary
from the list of Available Columns and add it to the list of Selected Columns.
Select
OK
to return to the SQL QUERY COLUMNS window.
You can also use the
File
menu to save queries. Select
File | Save Query | Save as Query to Include later |
Type ABOVE25 in the
Entry Name:
field. Type
Salaries above $25,000
in the Description field.
You can also save queries that will be processed against different tables. For the next query that you will save, select
View | Tables... |
to return to the SQL QUERY TABLES window. Remove
SAMPLE.SALARY from
the list of Selected Tables, and select
SAMPLE.EMPINFO
from the
list of Available Tables to add to the list of Selected Tables. Select
OK
to display the SQL QUERY COLUMNS window. Add
NAME
,
DIVISION
, and
Education Level
to the list of Selected
Columns. Select
View | Where Conditions for Subset... |
Select
Education level
from the list of Available Columns.
Select
GE
(Greater than or Equal to) from the list of Operators.
Select
<LOOKUP distinct values>
, and select
20
from the list of Lookup Values. Select
OK
to return to the SQL
QUERY COLUMNS window.
Select
File | Save Query | Save as Query to Include later |
Type EDU20 in the
Entry Name
field. Type
Education level above 20 years
in the Description field. Select
OK
to save the query.
Listing Saved Queries |
You can now display a list of the queries that you have saved, and include one of the queries. Select
File | List/Include Saved Queries |
The queries that you have created are listed in the Saved Queries window.
Including a Saved Query |
Select
SASUSER.PROFILE.EDU20
and select
OK
. A pop-up window asks
whether or not you want to clear the previous query or include the previous
query with the new one. Select
OK
.
Viewing Your Output |
You can run SASUSER.PROFILE.EDU20 by selecting
Tools | Run Query | Run Immediate |
The results are displayed in the OUTPUT window.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.