You can get a detailed description of any cas action result set using the describe statement.
proc cas;
/* Get a list of all the tables in the CASUSER caslib */
action table.tableinfo result=r/caslib="casuser";
/* Write a description of the result set to the SAS log */
describe r;
quit;
Produces this information in the SAS log:
dictionary ( 1 entries, 1 used);
[TableInfo] Table ( [2] Rows [24] columns
Column Names:
[1] Name [ ] (varchar)
[2] Label [ ] (varchar)
[3] Rows [ ] (int64)
[4] Columns [ ] (int64)
[5] IndexedColumns [Indexed Columns ] (int64)
[6] Encoding [ ] (char)
[7] CreateTimeFormatted [Created ] (varchar)
[8] ModTimeFormatted [Last Modified ] (varchar)
[9] AccessTimeFormatted [Last Accessed ] (varchar)
[10] JavaCharSet [Character Set ] (char)
[11] CreateTime [ ] (double)
[12] ModTime [ ] (double)
[13] AccessTime [ ] (double)
[14] Global [ ] (int32)
[15] Repeated [ ] (int32)
[16] View [ ] (int32)
[17] MultiPart [ ] (int32)
[18] SourceName [Loaded Source ] (varchar)
[19] SourceCaslib [Source Caslib ] (varchar)
[20] Compressed [ ] (int32)
[21] Creator [Table Creator ] (varchar)
[22] Modifier [Last Table Modifier] (varchar)
[23] SourceModTimeFormatted [Source Modified ] (varchar)
[24] SourceModTime [ ] (double)
So, the result set is a dictionary with a single entry, a table named TableInfo. In the TableInfo table, the NAME column contains the names of the tables in the caslib. We can use this table to drive other CAS actions. For example:
proc cas;
/* Get a list of all the tables in the CASUSER caslib */
action table.tableinfo result=r/caslib="casuser";
/* Using the result set, process every table in a specified caslib */
do i over r.tableinfo;
/* Display detailed table information */
table.tabledetails result=tinfo / caslib="casuser" name=i.name;
print tinfo;
/* Display detailed column information */
table.columninfo result=cinfo / table={caslib="casuser" name=i.name};
print cinfo;
/* Display 5 rows */
table.fetch / table={caslib="casuser" name=i.name} to=5;
end;
quit;
Produces the following results:
tinfo: Results from table.tableDetails
40 |
20 |
428 |
68480 |
0 |
20 |
72000 |
20 |
72000 |
0 |
0 |
0 |
0 |
0 |
cinfo: Results from table.columnInfo
|
char |
13 |
13 |
|
0 |
0 |
|
char |
40 |
40 |
|
0 |
0 |
|
char |
8 |
8 |
|
0 |
0 |
|
char |
6 |
6 |
|
0 |
0 |
|
char |
5 |
5 |
|
0 |
0 |
|
double |
8 |
8 |
DOLLAR |
8 |
0 |
|
double |
8 |
8 |
DOLLAR |
8 |
0 |
Engine Size (L) |
double |
8 |
12 |
|
0 |
0 |
|
double |
8 |
12 |
|
0 |
0 |
|
double |
8 |
12 |
|
0 |
0 |
MPG (City) |
double |
8 |
12 |
|
0 |
0 |
MPG (Highway) |
double |
8 |
12 |
|
0 |
0 |
Weight (LBS) |
double |
8 |
12 |
|
0 |
0 |
Wheelbase (IN) |
double |
8 |
12 |
|
0 |
0 |
Length (IN) |
double |
8 |
12 |
|
0 |
0 |
1 |
Acura |
MDX |
SUV |
Asia |
All |
$36,945 |
$33,337 |
3.5 |
6 |
265 |
17 |
23 |
4451 |
106 |
189 |
2 |
Audi |
RS 6 4dr |
Sports |
Europe |
Front |
$84,600 |
$76,417 |
4.2 |
8 |
450 |
15 |
22 |
4024 |
109 |
191 |
3 |
BMW |
745Li 4dr |
Sedan |
Europe |
Rear |
$73,195 |
$66,830 |
4.4 |
8 |
325 |
18 |
26 |
4464 |
123 |
204 |
4 |
Cadillac |
Seville SLS 4dr |
Sedan |
USA |
Front |
$47,955 |
$43,841 |
4.6 |
8 |
275 |
18 |
26 |
3992 |
112 |
201 |
5 |
Chevrolet |
Astro |
Sedan |
USA |
All |
$26,395 |
$23,954 |
4.3 |
6 |
190 |
14 |
17 |
4605 |
111 |
190 |
tinfo: Results from table.tableDetails
40 |
20 |
150 |
7200 |
0 |
20 |
10720 |
20 |
10720 |
0 |
0 |
0 |
0 |
0 |
cinfo: Results from table.columnInfo
Iris Species |
char |
10 |
10 |
0 |
0 |
Sepal Length (mm) |
double |
8 |
12 |
0 |
0 |
Sepal Width (mm) |
double |
8 |
12 |
0 |
0 |
Petal Length (mm) |
double |
8 |
12 |
0 |
0 |
Petal Width (mm) |
double |
8 |
12 |
0 |
0 |
1 |
Setosa |
50 |
33 |
14 |
2 |
2 |
Setosa |
49 |
30 |
14 |
2 |
3 |
Setosa |
51 |
35 |
14 |
3 |
4 |
Versicolor |
61 |
28 |
40 |
13 |
5 |
Versicolor |
58 |
27 |
39 |
12 |
You didn't specify how you wanted to save the tables - as files in the CASLIB (and what type - SASHDAT, CSV, etc) or as SAS data sets, so I have no sample code for that. But these same techniques should be able to be adapted for use with the table.save CAS action of the SAVERESULT statement to achieve your desired result.
Hope this helps. May the SAS be with you!