Chapter Contents |
Previous |
Next |
SAS/ACCESS Software for Relational Databases: Reference |
Note: The SAS/ACCESS Interface
to ORACLE does not support the following ORACLE data types: MLSLABEL and ROWID. SAS/ACCESS provides
an error message when it attempts to read a table that has at least one column
that uses an unsupported data type.
Character Data |
Numeric Data |
Other Data Types |
Note: For compatibility with other
DBMSs, ORACLE supports the syntax for a wide variety of numeric data types,
including DECIMAL, INTEGER, REAL, DOUBLE-PRECISION, and SMALLINT. All forms
of numeric data types are actually stored in the same internal ORACLE NUMBER
format. The additional numeric data types are variations of precision and
scale. A null scale implies a floating-point number, and a non-null scale
implies a fixed-point number.
See LIBNAME Statement Data Conversions and ACCESS Procedure Data Conversions for a description of how PROC ACCESS and the LIBNAME statement treat each of these types during input operations.
NULL and Default Values |
LIBNAME Statement Data Conversions |
LIBNAME Statement: Default SAS Formats for ORACLE Data Types shows the default SAS System variable formats that the LIBNAME statement assigns to ORACLE data types during input operations. You can override these input and output data types by using the DBTYPE= data set option during output processing.
Note: ORACLE data types that are omitted from this
table are not supported by SAS/ACCESS.
ORACLE Data Type | Default SAS Format | |
---|---|---|
CHAR(n) | $n. | |
VARCHAR2(n) | $n. | |
NUMBER | none (BEST. on OS/390 and CMS) | |
NUMBER(p) | w.(BEST. on OS/390 and CMS) | |
NUMBER(p, s) | w.d | |
DATE | DATETIME20. | |
LONG | $200. | |
RAW(n) | $HEXw. | |
LONG RAW | $HEX200. |
Note: SAS
automatically converts ORACLE NUMBER types to SAS number formats by using
an algorithm that determines the correct scale and precision. When the scale
and precision cannot be determined, the SAS/ACCESS Interface to ORACLE allows
the procedure or application to determine the format.
LIBNAME Statement: Default ORACLE Data Types for SAS Formats shows the default ORACLE data types that the LIBNAME statement assigns to SAS variable formats during output operations.
SAS Variable Format | ORACLE Data Type | |
---|---|---|
$w. |
VARCHAR2(n) | |
w. with SAS format name of NULL | NUMBER(p) | |
w.d with SAS format name of NULL | NUMBER(p,s) | |
all other numerics * | NUMBER (NUMBER(38,10) on OS/390 and CMS) | |
datetimew.d |
DATE | |
datew. |
DATE | |
time. ** | DATE |
* | Includes all SAS numeric formats, such as BINARY8 and E10.0. |
** | Includes all SAS time formats, such as TODw.d and HHMMw.d . |
ACCESS Procedure Data Conversions |
PROC ACCESS: Default SAS Formats for ORACLE Data Types shows the default SAS System variable formats that the ACCESS procedure assigns to ORACLE data types.
Note: ORACLE data types that are omitted from this
table are not supported by the SAS/ACCESS Interface.
ORACLE Data Type | Default SAS Format | |
---|---|---|
CHAR(n) | $n. (n <= 200) $200. (n > 200) | |
VARCHAR2(n) | $n. (n <= 200) $200. (n > 200) | |
FLOAT | BEST22. | |
NUMBER | BEST22. | |
NUMBER(p) | w. | |
NUMBER(p, s) | w.d | |
DATE | DATETIME16. | |
LONG | $200. | |
RAW(n) | $n. (n < 200) $200. (n > 200) | |
LONG RAW | $200. |
The general form of an ORACLE number is NUMBER(p,s) where p is the precision and s is the scale of the number. ORACLE defines precision as the total number of digits, with a valid range of -84 to 127. However, a negative scale means that the number is rounded to the specified number of places to the left of the decimal. For example, if the number 1,234.56 is specified as data type NUMBER(8,-2), it is rounded to the nearest hundred and stored as 1,200.
Default SAS Formats for ORACLE NUMBER Data Types shows the correlation between the ORACLE NUMBER data types and the default SAS formats that are created from that data type.
ORACLE NUMBER Data Type | Rules | Default SAS Format | |
---|---|---|---|
NUMBER(p) | 0 < p <= 32 | (p + 1).0 | |
NUMBER(p,s) | p > 0, s < 0, |s| < p |
(p + |s| + 1).0 | |
NUMBER(p,s) | p > 0, s < 0, |s| >= p |
(p + |s| + 1).0 | |
NUMBER(p,s) | p > 0, s > 0, s
< p |
(p + 2).s | |
NUMBER(p,s) | p > 0, s > 0, s
>= p |
(s + 3).s | |
NUMBER(p) | p > 32 | BEST22. SAS selects format | |
NUMBER | p,s unspecified | BEST22. SAS selects format |
DBLOAD Procedure Data Conversions |
PROC DBLOAD: Default ORACLE Data Types for SAS Formats shows the default ORACLE data types the DBLOAD procedure assigns to SAS variable formats.
SAS Variable Format | ORACLE Data Type | |
---|---|---|
$w. |
CHAR(n) | |
w. | NUMBER(p) | |
w.d |
NUMBER(p,s) | |
all other numerics * | NUMBER | |
datetimew.d |
DATE | |
datew. |
DATE | |
time. ** | NUMBER |
* | Includes all SAS numeric formats, such as BINARY8 and E10.0. |
** | Includes all SAS time formats, such as TODw.d and HHMMw.d . |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.