Here you go.
/*Set without quotations the libname variable to the library name and the dsname variable to the dataset name which you want to inquire about it's size*/
%let libname=?;
%let dsname=?;
/*Initiate CAS session*/
cas;
/*Use table.tabledetails to get the table size and save the result to work.cas_ds_memsize dataset*/
proc cas;
table.tabledetails result=res/ caslib="&libname." NAME="&dsname." showmem=true;
saveresult res dataout=work.cas_ds_memsize;
quit;
/*Query work.cas_ds_memsize dataset to display the size in megabyte (MB)*/
proc sql;
select
"&libname." as CAS_Library_Name,
"&dsname." as CAS_Dataset_Name,
(mem.MappedMemory/1024/1024) format=8.2 as Memsize_MB
from
work.cas_ds_memsize mem
;
quit;