Create the Proclib.Paylist table. The CREATE TABLE statement creates
Proclib.Paylist with six empty columns. Each column definition indicates whether the
column is character or numeric. The number in parentheses specifies the width of the
column. INFORMAT= and FORMAT= assign date informats and formats to the Birth
and Hired columns.
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.);
Insert values into the Proclib.Paylist table. The INSERT statement inserts data values
into Proclib.Paylist according to the position in the VALUES clause. Therefore, in the
first VALUES clause, 1639 is inserted into the first column, F into the second column,
and so on. Dates in SAS are stored as integers with 0 equal to January 1, 1960. Suffixing
the date with a
d is one way to use the internal value for dates.
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)
Include missing values in the data. The value null represents a missing value for the
character column Jobcode. The period represents a missing value for the numeric
column Salary.
values('1561','M',null,36514,'30NOV63'd,'07OCT87'd)
values('1221','F','FA3',.,'22SEP63'd,'04OCT94'd);
Specify the title.
title 'Proclib.Paylist Table';
Display the entire Proclib.Paylist table. The SELECT clause selects columns from
Proclib.Paylist. The asterisk (*) selects all columns. The FROM clause specifies
Proclib.Paylist as the table to select from.
select *
from proclib.paylist;
proc printto; run;
270 Chapter 7 • SQL Procedure