Understanding Methods of Creating Tables

You can use PROC SQL to create a table in three ways. The CREATE TABLE statement is used for all three methods, although the syntax of the statement varies for each method.
Method of Creating a Table
Example
create an empty table by defining columns
proc sql;
    create table work.discount
           (Destination char(3),
           BeginDate num Format=date9.,
           EndDate num format=date9.,
           Discount num);
create an empty table that is like (has the same columns and attributes as) an existing table
proc sql;
    create table work.flightdelays2
        like sasuser.flightdelays;
create a populated table (a table with both columns and rows of data) from a query result
proc sql;
   create table work.ticketagents as
      select lastname, firstname,
             jobcode, salary
         from sasuser.payrollmaster,
              sasuser.staffmaster
         where payrollmaster.empid
               = staffmaster.empid
         and jobcode contains 'TA';
The CREATE TABLE statement generates only a table as output, not a report. The SAS log displays a message that indicates that the table has been created, and the number of rows and columns that it contains.
Table 5.2 SAS Log
NOTE: Table WORK.FLIGHTDELAYS2 created, with 0 rows and 8 columns.
Note: You can display additional information about a table's structure in the SAS log by using the DESCRIBE TABLE statement in PROC SQL. The DESCRIBE TABLE statement is discussed later in this chapter.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.202.27