Chapter Contents

Previous

Next
Doing More with SAS/ASSIST Software

Using the Enhanced SQL Editor

The Enhanced Editor window is useful when you want to make changes in the SQL code. You can open the Enhanced Editor window from the SQL Editor window at any time. Any code in the SQL Editor appears in the Enhanced Editor window. In this example, you edit the join between the AIRLINE.DELAY and AIRLINE.FLINFO tables that you selected in the previous section.

  1. Follow this selection path:

    Edit
    [arrow]
    Enhanced Editor
    The Enhanced Editor window appears with the SQL statements from the SQL Editor window.

    Enhanced Editor Window

    [IMAGE]

  2. Edit the SQL code as follows. For a complete explanation of commands for using the Enhanced Editor, refer to the window's online help.

    The edited query is shown in the following display. The display is scrolled forward so that you can see the WHERE clause.

    Edited SQL Query

    [IMAGE]

  3. Select Close from the File menu to return to the SQL Editor window. You can perform further modifications to your query, run your query, or save it.

Note:   You can also run your query from the Enhanced Editor window by selecting Run from the RUN menu.  [cautionend]


Including and Writing SQL Code to External Files

In the Enhanced Editor window, you can include an external file that contains SQL code. Select Include from the File menu. The Include... window appears and prompts you to type a filename, as shown in the following display.

Include Window

[IMAGE]

Type an external file name and select OK to copy the SQL code into the SQL Editor window.

To write your SQL code to an external file, select Store SQL from the File menu. The Store SQL...window prompts you for the external file name, as shown in the following display.

Store SQL Window

[IMAGE]

Type an external file name and select OK to write the SQL code to your external file.

Note:   You can include IBM QMF queries in the SQL Editor window if you convert them for use in Query and Reporting. See Migrating from QMF to SAS/ASSIST Software for more information.  [cautionend]


Correcting Errors in SQL Code

It is usually difficult to create perfectly correct SQL code the first time. If you run incorrect SQL code, you will get errors. The SQL Editor window has a SAS log for you to review so that you can correct your code.

Using the example from earlier in this chapter, if you incorrectly type the A.FLIGHT column name as A.FLIGHTT in the WHERE clause and you run the program, the Report Log window appears, informing you that an error has occurred.

Select View SAS Log from the Run menu to open a SAS log that is customized for SAS/ASSIST software. The following display indicates that the A.FLIGHTT column was not found in the AIRLINE.DELAY table.

SAS Log Window

[IMAGE]

Select Close from the File menu twice to return to the SQL Editor window. Correct your code and run it again.

When you run your SQL code successfully, your output appears in the Report Output window (or in the output window that is defined for your system). From the SQL Editor window, you can select Report Log from the View menu to see the most recent SAS log for your output.


Chapter Contents

Previous

Next

Top of Page

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