This topic was raised in connection with a separate inquiry regarding the use of persisted .sashdat format files in CAS.
To avoid turning that discussion into an extensive deep dive on caslibs etc., I decided it was more appropriate to address the subject in a dedicated post.
Given the nuances and occasional ambiguity surrounding CASLIBs, librefs, and format libraries, I’ve shared my observations and understanding here.
I welcome any additional insights or corrections from CAS experts to help clarify the topic further.
I have intentionally avoided inserted code in this assessment.
The code snippets referenced are meant solely to provide context for the discussion and are not intended to be run.
I did change the text color of relevant snippets for clarity.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CASLIB
The caslib name can exceed 8 characters
Example: vhrf56789
A caslib points to a ‘path’
This path likely corresponds to a directory on the SAS Infrastructure Data Server (sometimes referred to as the “file system” or “file micro-service”).
caslib vhrf56789 sessref=CASAUTO datasource=(srctype="path")
path="/workspace/ ….. /viya_home_raw_files/";
NOTE: 'VHRF56789' is now the active caslib.
LIBREF
Librefs (that point to the caslib) must follow the traditional SAS constraint of ≤ 8 characters.
libname vhrf cas caslib= VHRF56789;
CASLIB vs LIBREF usage
Caslib can be referenced directly inside any CASL (CAS language) statement
proc cas;
table.fetch
table={caslib="VHRF56789" name="table_test"};
quit;
Libref must be utilized to reference the caslib outside of CASL
data vhrf.table_test_format;
set vhrf.table_test;
format var1 frmt.;
run;
proc print data= vhrf.table_test_format noobs; run;
CAS format library names
Empirically, can also exceed 8 characters
proc format casfmtlib="CASformats"; /* <<< lib=work.formats is implicit*/
value frmt
1 = 'abc';
run;
cas casauto listformats MEMBERS;
NOTE: Fmtlib = CASFORMATS
Scope = Session
Fmtsearch = YES
Format = frmt
These names appear to function more like metadata identifiers for the library that contains the underlying .sashdat format file
The actual “residence” of the CAS format library is unclear—it may be abstracted by the CAS infrastructure and not directly tied to a visible file system location