Chapter Contents |
Previous |
Next |
SAS/ACCESS Software for Relational Databases: Reference |
Note: SAS/ACCESS does
not support the following SYBASE data types: BINARY, VARBINARY, IMAGE, NCHAR(n), and NVARCHAR(n). 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 |
You must enclose all character data in single or double quotation marks.
Numeric Data |
Abstract Data |
DATETIME values are input as quoted character strings in various alphabetic or numeric formats. Time data must be entered in the prescribed order (hours; minutes; seconds; milliseconds; AM, am, PM, pm) and must include either a colon or an AM/PM designator. Case is ignored, and spaces can be inserted anywhere within the value.
When you input DATETIME values, the national language setting determines how the date values are interpreted. You can change the default date order with the SET DATEFORMAT statement. See your Transact-SQL documentation for more information.
You can use SYBASE built-in date functions to perform some arithmetic calculations on DATETIME values.
MONEY values are accurate to a ten-thousandth of a monetary unit. However, when they are displayed, the dollar sign is omitted and MONEY values are rounded up to two places. A comma is inserted after every three digits.
You can store values for currencies other than USA dollars, but no form of conversion is provided.
User-Defined Data Types |
You can supplement the SYBASE
system data types by defining your
own data types with the SYBASE system procedure
sp_addtype
. When you define
your own data type for a column, you can specify a default value (other than
NULL) for the column and define a range of allowable values for the column.
NULL Values |
By default, SYBASE columns are defined as NOT NULL. NOT NULL tells SYBASE not to add a row to the table unless the row has a value for the specified column.
If you want a column to accept NULL values, you must explicitly define it as NULL. Here is an example of a CREATE TABLE statement that defines all of the columns for a table to be NULL except for CUSTOMER. In this case, SYBASE only accepts a row that contains a value for CUSTOMER.
create table CUSTOMERS (CUSTOMER char(8) not null, STATE char(2) null, ZIPCODE char(5) null, COUNTRY char(20) null, TELEPHONE char(12) null, NAME char(60) null, CONTACT char(30) null, STREETADDRESS char(40) null, CITY char(25) null, FIRSTORDERDATE datetime null);
LIBNAME Statement Data Conversions |
LIBNAME Statement: Default SAS Formats for SYBASE Server Data Types shows the default SAS System variable formats that the libname statement assigns to SYBASE data types during input operations.
SYBASE Column Type | SAS Data Type | Default SAS Format |
---|---|---|
CHAR(n ) | character | $n. (n <= 255) $255. (n > 255) |
VARCHAR(n ) | character | $n. (n <= 255) $255. (n > 255) |
TEXT | character | $n. (n <= 32,767) $32,767. (n > 32,767) |
BIT | numeric | 1.0 |
TINYINT | numeric | 4.0 |
SMALLINT | numeric | 6.0 |
INT | numeric | 11.0 |
NUMERIC | numeric | w, w.d (if possible) |
DECIMAL | numeric | w, w.d (if possible) |
FLOAT | numeric | |
REAL | numeric | |
SMALLMONEY | numeric | DOLLAR12.2 |
MONEY | numeric | DOLLAR24.2 |
SMALLDATETIME | numeric | DATETIME22.3 |
DATETIME | numeric | DATETIME22.3 |
TIMESTAMP | hex | $HEXw |
LIBNAME STATEMENT: Default SYBASE Data Types for SAS Variable Formats shows the default SYBASE data types that the LIBNAME statement assigns to SAS variable formats during ouput operations.
SAS Variable Format | SYBASE Data Type |
---|---|
$w., $CHARw., $VARYINGw., $HEXw. | VARCHAR(w) |
any datetime, date, or time format | DATETIME |
any numeric with a SAS format name of w.d or w. | NUMERIC(p,s) |
any other numeric | FLOAT |
You can override these default data types by using the DBTYPE= option on the data set.
ACCESS Procedure Data Conversions |
PROC ACCESS: Default SAS Formats for SYBASE Server Data Types shows the default SAS System variable formats that the ACCESS procedure assigns to SYBASE data types.
SYBASE Column Type | SAS Data Type | Default SAS Format |
---|---|---|
CHAR(n ) | character | $n. (n <= 200) $200. (n > 200) |
VARCHAR(n ) | character | $n. (n <= 200) $200. (n > 200) |
BIT | numeric | 1.0 |
TINYINT | numeric | 4.0 |
SMALLINT | numeric | 6.0 |
INT | numeric | 11.0 |
FLOAT | numeric | BEST22. |
REAL | numeric | BEST11. |
SMALLMONEY | numeric | DOLLAR12.2 |
MONEY | numeric | DOLLAR24.2 |
SMALLDATETIME | numeric | DATETIME21.2 |
DATETIME | numeric | DATETIME21.2 |
The ACCESS procedure also supports SYBASE user-defined data types. The ACCESS procedure uses the SYBASE data type on which a user-defined data type is based in order to assign a default SAS format for columns.
Note: The DECIMAL, NUMERIC, and TEXT data types are not supported
in PROC ACCESS. The TIMESTAMP data type is not displayed in PROC ACCESS.
DBLOAD Procedure Data Conversions |
PROC DBLOAD: Default SYBASE Data Types for SAS Variable Formats shows the default SYBASE data types that the DBLOAD procedure assigns to SAS variable formats.
SAS Variable Format | SYBASE Data Type |
---|---|
$w., $CHARw., $VARYINGw., $HEXw. | VARCHAR(w) |
w. |
TINYINT |
w. |
SMALLINT |
w. |
INT |
w. |
FLOAT |
w.d |
FLOAT |
IBw.d, PIBw.d | INT |
FRACT, E format, and other numeric formats | FLOAT |
DOLLARw.d, w<=12 | SMALLMONEY |
DOLLARw.d, w>12 | MONEY |
any datetime, date, or time format | DATETIME |
The DBLOAD procedure also supports SYBASE user-defined data types. Use the TYPE= statement to specify a user-defined data type.
Inserting TEXT into SYBASE from SAS |
data yourlib.newtable(bulk=yes); set work.sasbigtext; run;
If the BULK option is not used, you will receive the following error message:
ERROR: Object not found in database. Error Code: -2782 An untyped variable in the PREPARE statement 'S401bcf78' is being resolved to a TEXT or IMAGE type. This is illegal in a dynamic PREPARE statement.
National Language Support for SYBASE |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.