Published on :
Data Management CREATION_INTERNE

Table Details (tableDetails Action)

This code is also available in: Deutsch Español Français
Awaiting validation
This functionality is crucial for monitoring and optimizing the performance of in-memory tables in a SAS© Viya environment. It provides an overview of the internal structure and memory footprint of a CAS table. Parameters allow controlling the granularity level of the information (summary, by node, or by partition) and including details on memory usage. It is possible to specify the CAS library (caslib) where the table resides and to limit the amount of information returned per node for very large distributed tables, which is particularly useful for administrators and developers to understand the state of in-memory data.
Data Analysis

Type : CREATION_INTERNE


The examples use CAS tables created directly via DATA steps or 'loadTable' actions to illustrate the functionality without external dependencies.

1 Code Block
PROC CAS Data
Explanation :
This example demonstrates the simplest use of the 'tableDetails' action. It first creates a small table named 'simple_data' in the 'casuser' caslib, then uses the action to display summary information about this table, such as the number of rows and columns. By default, the aggregation level is 'SUM' and memory information is included.
Copied!
1PROC CAS;
2 /* Crée une table simple en mémoire dans la caslib 'casuser' */
3 DATA casuser.simple_data;
4 INPUT id name $;
5 DATALINES;
61 Alice
72 Bob
83 Charlie
9;
10 RUN;
11 
12 /* Obtient les détails de base pour la table 'simple_data' */
13 TABLE.tableDetails / name="simple_data";
14QUIT;
2 Code Block
PROC CAS Data
Explanation :
This case shows how to use the 'caslib' parameter to target a specific table if it is not in the active caslib. A 'product_info' table is created, and its details are retrieved by specifying 'casuser' as the caslib. It also illustrates the use of the 'table' alias for the 'name' parameter.
Copied!
1PROC CAS;
2 /* Crée une table 'product_info' dans la caslib 'casuser' */
3 DATA casuser.product_info;
4 INPUT product $ price;
5 DATALINES;
6Apple 1.00
7Banana 0.50
8Orange 0.75
9Mango 2.20
10;
11 RUN;
12 
13 /* Obtient les détails pour 'product_info' en spécifiant explicitement la caslib. */
14 /* Utilisation de l'alias 'table' pour le paramètre 'name'. */
15 TABLE.tableDetails /
16 TABLE="product_info",
17 caslib="casuser";
18QUIT;
3 Code Block
PROC CAS Data
Explanation :
This example uses a larger table ('large_transactions') to illustrate obtaining details at each CAS cluster node level ('level="NODE"'). It also excludes detailed memory usage information ('showMem=FALSE') for a more concise output, which is useful for large distributed tables.
Copied!
1PROC CAS;
2 /* Crée une table plus grande pour simuler la distribution sur plusieurs nœuds */
3 DATA casuser.large_transactions;
4 DO i = 1 to 10000;
5 region = IF mod(i, 4) = 0 THEN 'North'
6 ELSE IF mod(i, 4) = 1 THEN 'South'
7 ELSE IF mod(i, 4) = 2 THEN 'East'
8 ELSE 'West';
9 amount = 100 + ranuni(0) * 1000;
10 OUTPUT;
11 END;
12 RUN;
13 
14 /* Obtient les détails par nœud sans inclure les informations mémoire */
15 TABLE.tableDetails /
16 name="large_transactions",
17 caslib="casuser",
18 level="NODE",
19 showMem=FALSE;
20QUIT;
4 Code Block
PROC CAS / table.partition Data
Explanation :
This advanced example shows how to obtain details for a partitioned table. It creates and partitions a 'raw_sales' table by the 'Region' variable using the 'table.partition' action. Then, it uses 'tableDetails' with 'level="PARTITION"' to display information for each partition. The 'perNode=2' parameter is used to limit the amount of detail reported per node, which is useful for managing output size with highly distributed tables.
Copied!
1PROC CAS;
2 /* Crée une table avec des données à partitionner */
3 DATA casuser.raw_sales;
4 INPUT Date:yymmdd. Region $ Sales;
5 FORMAT Date yymmdd10.;
6 DATALINES;
72023-01-01 North 100
82023-01-01 South 150
92023-01-02 East 120
102023-01-02 West 180
112023-01-03 North 110
122023-01-03 South 160
132023-01-04 East 130
142023-01-04 West 190
152023-01-05 North 200
162023-01-05 South 210
172023-01-06 East 220
182023-01-06 West 230
19;
20 RUN;
21 
22 /* Partitionne la table par la variable 'Region' */
23 TABLE.partition /
24 name="raw_sales",
25 caslib="casuser",
26 groupBy={"Region"},
27 casOut={name="partitioned_sales_by_region", caslib="casuser", replace=true};
28 
29 /* Obtient les détails par partition, en limitant la sortie à 2 blocs par nœud */
30 TABLE.tableDetails /
31 name="partitioned_sales_by_region",
32 caslib="casuser",
33 level="PARTITION",
34 perNode=2;
35QUIT;
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.