By using PROC SQL, you
can create, modify, and drop (delete) tables quickly and efficiently.
Many PROC SQL statements are quite versatile, enabling you to perform
the same action in several ways. For example, there are three methods
of creating a table by using the CREATE TABLE statement:
-
creating an empty table (a table
without rows) by defining columns
-
creating an empty table that has
the same columns and attributes as another table
-
creating a table from a query result.
The following PROC SQL
step uses the CREATE TABLE statement to create an empty table by defining
columns, and uses the DESCRIBE TABLE statement to display information
about the table's structure in the SAS log:
proc sql;
create table work.discount
(Destination char(3),
BeginDate num Format=date9.,
EndDate num format=date9.,
Discount num);
describe table work.discount;
Table 5.1 SAS Log
1 proc sql;
2 create table work.discount
3 (Destination char(3),
4 BeginDate num Format=date9.,
5 EndDate num format=date9.,
6 Discount num);
NOTE: Table WORK.DISCOUNT created, with 0 rows and 4 columns.
7 describe table work.discount;
NOTE: SQL table WORK.DISCOUNT was created like:
create table WORK.DISCOUNT( bufsize=4096 )
(
Destination char(3),
BeginDate num format=DATE9.,
EndDate num format=DATE9.,
Discount num
);
|