Chapter Contents

Previous

Next
The SQL Procedure

Example 1: Creating a Table and Inserting Data into It


Procedure features:
CREATE TABLE statement
column-modifier
INSERT statement
VALUES clause
SELECT clause
FROM clause
Table: PROCLIB.PAYLIST

This example creates the table PROCLIB.PAYLIST and inserts data into it.



Program

libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
proc sql;
   create table proclib.paylist
       (IdNum char(4),
        Gender char(1),
        Jobcode char(3),
        Salary num,
        Birth num informat=date7.
                  format=date7.,
        Hired num informat=date7.
                  format=date7.);
 Note about code
insert into proclib.paylist
    values('1639','F','TA1',42260,'26JUN70'd,'28JAN91'd)
    values('1065','M','ME3',38090,'26JAN54'd,'07JAN92'd)
    values('1400','M','ME1',29769.'05NOV67'd,'16OCT90'd)




 Note about code
    values('1561','M',null,36514,'30NOV63'd,'07OCT87'd)
    values('1221','F','FA3',.,'22SEP63'd,'04OCT94'd);

 Note about code
title 'PROCLIB.PAYLIST Table';
select *
   from proclib.paylist;


Output Table
PROCLIB.PAYLIST [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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