Published on :

Data Types Supported by SAS Viya Platform

This code is also available in: Deutsch Español Français
Awaiting validation
The SAS© Viya Platform CAS (Cloud Analytic Services) server natively manages several data types. 'CHARACTER' and 'NUMERIC' are traditional SAS© types. The 'VARBINARY' type is specifically used for binary files (images, audio, documents). 'INT32' and 'INT64' types offer greater numerical precision than the traditional 'NUMERIC' type, and all operations performed on the CAS engine maintain this precision. However, calculations in DATA steps or procedures executed on the SAS©®9 engine are converted to 'NUMERIC' (DOUBLE) values. The 'VARCHAR' type is characterized by variable length and uses character semantics, unlike 'CHARACTER' which has a fixed length and uses byte semantics. When loading data, unsupported types are automatically converted to native CAS server types. The document also provides a detailed compatibility table indicating support for various data types by different SAS© Viya functionalities (CAS Actions, CASL, Data Connectors, Procedures and DATA Step, DS2, FedSQL, Compute Server Processing).
Data Analysis

Type : SASHELP


No SAS code examples are directly provided in the documentation. Concepts are explained textually and via a data type compatibility table. For data creation, it would be necessary to simulate tables with various data types using datalines or SASHELP tables to illustrate conversions and compatibility.

1 Code Block
DATA STEP Data
Explanation :
This example creates an in-memory CAS table (`mycas.datatypes_example`) and demonstrates the declaration of variables with different data types supported by the CAS server (CHARACTER, VARCHAR, INT32, INT64, DOUBLE). The DATA step is used to populate the table. Then, the `PROC CASUTIL` procedure with the `CONTENTS` option is used to display the table properties, including the data types inferred by CAS, which allows verifying how the server handled the declarations. This illustrates how data is structured and stored in the CAS environment.
Copied!
1/* Création d'une session CAS */
2options casport=5570 cashost="localhost";
3cas mysess;
4 
5/* Utilisation d'une bibliothèque CAS */
6LIBNAME mycas cas caslib=casuser;
7 
8/* Création d'une table CAS avec divers types de données */
9DATA mycas.datatypes_example;
10 LENGTH char_var $10 varchar_var varchar(20) int32_var int32 int64_var int64 double_var 8;
11 char_var = 'Texte';
12 varchar_var = 'Texte plus long';
13 int32_var = 12345;
14 int64_var = 1234567890123456789;
15 double_var = 123.456;
16 OUTPUT;
17RUN;
18 
19/* Affichage des propriétés de la table pour vérifier les types */
20PROC CASUTIL incaslib='casuser' outcaslib='casuser' host='localhost';
21 contents casdata='datatypes_example';
22RUN;
23 
24/* Libération de la session CAS */
25cas mysess terminate;
26 
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.