Every column in a table has a name and a data type. The data type tells Google BigQuery how much physical storage to set aside for the column and the form in which the data is stored.
For information about Google BigQuery data types and to determine which data types are available for your version of Google BigQuery, see your Google BigQuery documentation.
Here are the data types that the Google BigQuery engine supports.
| BYTES | STRING |
| JSON |
| BIGINT | FLOAT64 |
| BIGNUMERIC | NUMERIC |
| BOOL |
| DATE | TIME |
| DATETIME | TIMESTAMP |
| ARRAY | RECORD (also referred to as STRUCT) |
| GEOGRAPHY |
This table shows the default formats that SAS/ACCESS Interface to Google BigQuery assigns to SAS variables when using the LIBNAME statement to read from a Google BigQuery table. These default formats are based on Google BigQuery column attributes.
|
Google BigQuery Data Type |
SAS Data Type |
Default SAS Format |
|---|---|---|
|
Character Data |
||
|
BYTES |
CHAR |
$HEXw. |
|
JSON |
CHAR |
$w. |
|
STRING |
CHAR |
$w. |
|
Numeric Data |
||
|
BIGINT |
NUMERIC |
20. |
|
BIGNUMERIC |
NUMERIC |
w.d |
|
BOOL |
NUMERIC |
1. |
|
FLOAT64 |
NUMERIC |
none w.d |
|
NUMERIC |
NUMERIC |
none w.d |
|
Date and Time Data |
||
|
DATE |
NUMERIC |
DATE9. |
|
DATETIME |
NUMERIC |
DATETIME25.6 |
|
TIME |
NUMERIC |
TIME15.6 |
|
TIMESTAMP |
NUMERIC |
DATETIME25.6 |
|
Other Data |
||
|
ARRAY |
VARCHAR |
$w.2 |
|
GEOGRAPHY |
VARCHAR |
$w.2 |
|
RECORD1 |
VARCHAR |
$w.2 |
| 1 Also referred to as a STRUCT in Google BigQuery. | ||
| 2 The default length is based on MAX_CHAR_LEN. | ||
This table shows the default Google BigQuery data types that SAS/ACCESS assigns to SAS variable formats during output operations when you use the LIBNAME statement.
|
SAS Variable Format |
Google BigQuery Data Type |
|---|---|
|
w.d |
DOUBLE |
|
w. |
BIGINT |
|
$w. |
VARCHAR |
|
datetime formats |
DATETIME TIMESTAMP |
|
date formats |
DATE |
|
time formats |
TIME |
SAS/ACCESS Interface to Google BigQuery supports the use of BINARY data. When binary data is displayed, the value is typically padded with spaces (0x20) at the end of a value. To control the length of values that are displayed when using PROC PRINT, PROC SQL, or other procedures, specify a value for the MAX_BINARY_LEN= LIBNAME option. Otherwise, these procedures might truncate the data with different lengths.
When you load ARRAY data into SAS, the data is loaded as VARCHAR data. The default length of the data is based on MAX_CHAR_LEN.
To work with ARRAY data as the data type that is assigned in Google BigQuery, use PROC SQL to pass SQL queries down to the database.