Chapter Contents

Previous

Next
The SQL Procedure

Example 5: Combining Two Tables


Procedure features:
DELETE statement
IS condition
RESET statement option
DOUBLE
UNION set operator
Tables: PROCLIB.NEWPAY, PROCLIB.PAYLIST, PROCLIB.PAYLIST2

This example creates a new table, PROCLIB.NEWPAY, by concatenating two other tables: PROCLIB.PAYLIST and PROCLIB.PAYLIST2.



Input Tables
PROCLIB.PAYLIST [HTML Output]
 [Listing Output]
PROCLIB.PAYLIST2 [HTML Output]
 [Listing Output]


Program

libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
proc sql;
   create table proclib.newpay as
      select * from proclib.paylist
      union
      select * from proclib.paylist2;
 Note about code
   delete
      from proclib.newpay
      where jobcode is missing or salary is missing;

 Note about code
   reset double;
   title 'Personnel Data';
   select *
      from proclib.newpay;


Output
[HTML Output]  [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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