column-definition Component
Defines PROC SQL's data types and dates
| See: | column-modifier Component |
|---|---|
| Example: | Creating a Table and Inserting Data into It |
Table of Contents
Syntax
Required Arguments
column
is a column name.
data-type
is one of the following data types:
CHARACTER | VARCHAR <(width)>
indicates a character column with a column width of width. The default column width is eight characters.
INTEGER | SMALLINT
indicates an integer column.
DECIMAL | NUMERIC | FLOAT <(width<, ndec>)>
indicates a floating-point column with a column width of width and ndec decimal places.
REAL | DOUBLE PRECISION
indicates a floating-point column.
DATE
indicates a date column.
Optional Argument
column-modifier
Details
- SAS supports many but not all of the data types that SQL-based databases support.
- For all the numeric data types (INTEGER, SMALLINT, DECIMAL, NUMERIC, FLOAT, REAL, DOUBLE PRECISION, and DATE), the SQL procedure defaults to the SAS data type NUMERIC. The width and ndec arguments are ignored; PROC SQL creates all numeric columns with the maximum precision allowed by SAS. If you want to create numeric columns that use less storage space, then use the LENGTH statement in the DATA step. The various numeric data type names, along with the width and ndec arguments, are included for compatibility with other SQL software.
- For the character data types (CHARACTER and VARCHAR), the SQL procedure defaults to the SAS data type CHARACTER. The width argument is honored.
- The CHARACTER, INTEGER, and DECIMAL data types can be abbreviated to CHAR, INT, and DEC, respectively.
- A column that is declared with DATE is a SAS numeric variable with a date informat or format. You can use any of the column-modifiers to set the appropriate attributes for the column that is being defined. For more information about dates, see SAS Formats and Informats: Reference.
- When using the VARCHAR2 data type for the Oracle database, or the VARCHAR data type for Greenplum and Aster databases, do not use trailing blanks in column values. Trailing blanks in the VARCHAR2 and VARCHAR data types are considered significant for some databases. Therefore, the results might not be correct, and the generated query is less efficient.
Last updated: September 10, 2026