Previous Page | Next Page

Query and Reporting

Creating New Tables

You can create a table from a query using the SQL Editor window or the Query window.

In all operating environments, you can create SAS tables and views. In z/OS, you can also create DB2 tables. In some cases you must be granted certain access or privileges to create new tables. If you do not have these privileges, contact your SAS Support Consultant or database administrator.

To create a table from your query results, run your query, then return to the Query window by selecting Close from the File menu. Follow the instructions in one of the following two sections, depending on which type of table you want to create.


Creating a New SAS Table or View

Follow these steps to create a new SAS table or view from your query results:

  1. Follow this selection path from the Query window:Tools [arrow] Create Table [arrow] SASThe Create SAS Table/View window appears.

  2. In the Name field, type the name of the table or view. Use a two-level name in the form libref.table-name if you want to store the table or view permanently.

  3. Select Table or View. Table creates a SAS data file; View creates a PROC SQL view.

  4. When you select OK, the query is processed and a window verifies the SAS table's creation, as shown in the following display.

    SAS Table/View Creation Status Window

    [SAS Table/View Creation Status Window]

  5. Select View to display the new SAS table, or select Goback to return to the Query window.


Creating a New DB2 Table (z/OS Only)

In z/OS, to save the results of your query to a DB2 table, do the following:

  1. Follow this selection path from the Query window:Tools [arrow] Create Table [arrow] DB2The Create DB2 Table window appears.

  2. In the Name of DB2 table field, type the name of the table.

  3. Select OK SAS/ASSIST software verifies whether or not the table exists; if it does, you are prompted to append or replace it. The new table is created, and its authorization ID is automatically set to your userid.

Note:   If you plan to use DB2 data in several SAS programs, you usually get better SAS performance if you save the DB2 data to a SAS table or SAS view.  [cautionend]

Previous Page | Next Page | Top of Page