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 */
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.