Be extremely careful when processing INT64 variables (like credit card numbers or high-precision IDs) in a standard SAS DATA Step running on the Compute Server. Since the traditional SAS engine does not natively support 64-bit integers, it converts them to standard NUMERIC (floating-point doubles); if the integer value exceeds 15-16 digits (specifically $2^{53}$), the conversion will result in a loss of precision, potentially corrupting your ID keys.
Stop wasting memory on whitespace—switch to VARCHAR for variable text.
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!
/* Création d'une session CAS */
options casport=5570 cashost="localhost";
cas mysess;
/* Utilisation d'une bibliothèque CAS */
libname mycas cas caslib=casuser;
/* Création d'une table CAS avec divers types de données */
data mycas.datatypes_example;
length char_var $10 varchar_var varchar(20) int32_var int32 int64_var int64 double_var 8;
char_var = 'Texte';
varchar_var = 'Texte plus long';
int32_var = 12345;
int64_var = 1234567890123456789;
double_var = 123.456;
output;
run;
/* Affichage des propriétés de la table pour vérifier les types */
proc casutil incaslib='casuser' outcaslib='casuser' host='localhost';
contents casdata='datatypes_example';
run;
/* Libération de la session CAS */
cas mysess terminate;
1
/* Création d'une session CAS */
2
options casport=5570 cashost="localhost";
3
cas mysess;
4
5
/* Utilisation d'une bibliothèque CAS */
6
LIBNAME mycas cas caslib=casuser;
7
8
/* Création d'une table CAS avec divers types de données */
Critical Rule: If you are working with long ID numbers (greater than 15 digits), never process them in a standard DATA step or PROC SQL. Keep them inside CAS (using FedSQL or CASL) or convert them to strings before bringing them to the Compute Server.
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.
Notice: Undefined variable: stmtFrFallback in /var/www/app/detail_sascode.php on line 1428
Fatal error: Uncaught Error: Call to a member function execute() on null in /var/www/app/detail_sascode.php:1428
Stack trace:
#0 {main}
thrown in /var/www/app/detail_sascode.php on line 1428