Chapter Contents




Changes a SAS format for a DBMS column.

Optional statement
Applies to: access descriptor or view descriptor
Interacts with: ASSIGN, DROP, RESET



FORMAT <'>column-identifier-1<'>


The FORMAT statement changes a SAS variable format from its default format; the default SAS variable format is based on the data type of the DBMS column. (See your DBMS chapter for information on the default formats that the SAS System assigns to your DBMS data types.)

An editing statement, such as FORMAT, must follow the CREATE or UPDATE statement and the database connection statements when you create or update a descriptor. See CREATE for more information on the order of statements.

The column-identifier argument can be either the column name or the positional equivalent from the LIST statement, which is the number that represents the column's place in the access descriptor. For example, to associate the DATE9. format with the BIRTHDATE column and with the second column in the access descriptor, submit the following statement:

format 2=date9. birthdate=date9.;

The column identifier is specified on the left and the SAS format on the right of the expression. The equal sign (=) is optional. If the column name contains lowercase characters, special characters, or national characters, enclose the name in quotes. You can enter formats for as many columns as you want in one FORMAT statement.

The following example creates the access descriptor ADLIB.PRODUCT on the DB2 table SASDEMO.SPECPROD. The FORMAT statement is used to specify new SAS variable formats for four columns from the DBMS table.

proc access dbms=db2;
   create adlib.product.access;
   rename productid prodid
          fibername fiber;
   format productid  4.
          weight     e16.9
          fibersize  e20.13
          width      e16.9;

You can use the FORMAT statement with a view descriptor only if the ASSIGN statement that was used when creating the access descriptor was specified with the NO value.

FMT is the alias for the FORMAT statement.

Note:   When you use the FORMAT statement with access descriptors, the FORMAT statement also reselects columns that were previously dropped with the DROP statement.  [cautionend]

Chapter Contents



Top of Page

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