Chapter Contents

Previous

Next
The SQL Procedure

Example 2: Creating a Table from a Query's Result


Procedure features:
CREATE TABLE statement
AS query-expression
SELECT clause
column alias
FORMAT= column-modifier
object-item
Other features:
data set option
OBS=
Tables:
PROCLIB.PAYROLL, PROCLIB.BONUS

This example builds a column with an arithmetic expression and creates the PROCLIB.BONUS table from the query's result.



Input Table
PROCLIB.PAYROLL (Partial Listing) [HTML Output]
 [Listing Output]


Program

libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
proc sql;
   create table proclib.bonus as
 Note about code
   select IdNumber, Salary format=dollar8.,
          salary*.025 as Bonus format=dollar8.
      from proclib.payroll;

 Note about code
   title 'BONUS Information';
   select *
      from proclib.bonus(obs=10);


Output
PROCLIB.BONUS [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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