<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic caslib vs CAS libref (+ CAS format library) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/caslib-vs-CAS-libref-CAS-format-library/m-p/978308#M378595</link>
    <description>&lt;P&gt;This topic was raised in connection with a separate inquiry regarding the use of persisted .sashdat format files in CAS.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;Given the nuances and occasional ambiguity surrounding CASLIBs, librefs, and format libraries, I’ve shared my observations and understanding here.&lt;/P&gt;
&lt;P&gt;I welcome any additional insights or corrections from CAS experts to help clarify the topic further.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have intentionally avoided inserted code in this assessment.&lt;/P&gt;
&lt;P&gt;The code snippets referenced are meant solely to provide context for the discussion and are not intended to be run.&lt;/P&gt;
&lt;P&gt;I did change the text color of relevant snippets for clarity.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;CASLIB&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The caslib name can exceed 8 characters&lt;/P&gt;
&lt;P&gt;Example: &lt;FONT color="#0000FF"&gt;vhrf56789&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A caslib points to a ‘path’&lt;/P&gt;
&lt;P&gt;This path likely corresponds to a directory on the SAS Infrastructure Data Server (sometimes referred to as the “file system” or “file micro-service”).&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;caslib vhrf56789 sessref=CASAUTO datasource=(srctype="path")&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;path="/workspace/ ….. /viya_home_raw_files/";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;NOTE: 'VHRF56789' is now the active caslib.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;LIBREF&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Librefs (that point to the caslib) must follow the traditional SAS constraint of ≤ 8 characters.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;libname &lt;STRONG&gt;vhrf&lt;/STRONG&gt; cas caslib= VHRF56789;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;CASLIB vs LIBREF usage&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Caslib can be referenced directly inside any CASL (CAS language) statement&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc cas;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;table.fetch&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;table={caslib="&lt;STRONG&gt;VHRF56789&lt;/STRONG&gt;" name="table_test"};&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Libref must be utilized to reference the caslib outside of CASL&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data &lt;STRONG&gt;vhrf&lt;/STRONG&gt;.table_test_format;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;set &lt;STRONG&gt;vhrf&lt;/STRONG&gt;.table_test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;format var1 frmt.;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc print data= &lt;STRONG&gt;vhrf&lt;/STRONG&gt;.table_test_format noobs; run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;CAS format library names &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Empirically, can also exceed 8 characters&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc format casfmtlib="&lt;STRONG&gt;CASformats&lt;/STRONG&gt;"; &lt;FONT color="#993300"&gt;/* &amp;lt;&amp;lt;&amp;lt; lib=work.formats is implicit*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;value frmt&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;1 = 'abc';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;cas casauto listformats MEMBERS;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;NOTE: Fmtlib = &lt;STRONG&gt;CASFORMATS&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Scope = Session&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fmtsearch = YES&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Format = frmt&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These names appear to function more like metadata identifiers for the library that contains the underlying .sashdat format file&lt;/P&gt;
&lt;P&gt;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&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Nov 2025 14:06:53 GMT</pubDate>
    <dc:creator>Rampsas1</dc:creator>
    <dc:date>2025-11-04T14:06:53Z</dc:date>
    <item>
      <title>caslib vs CAS libref (+ CAS format library)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/caslib-vs-CAS-libref-CAS-format-library/m-p/978308#M378595</link>
      <description>&lt;P&gt;This topic was raised in connection with a separate inquiry regarding the use of persisted .sashdat format files in CAS.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;Given the nuances and occasional ambiguity surrounding CASLIBs, librefs, and format libraries, I’ve shared my observations and understanding here.&lt;/P&gt;
&lt;P&gt;I welcome any additional insights or corrections from CAS experts to help clarify the topic further.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have intentionally avoided inserted code in this assessment.&lt;/P&gt;
&lt;P&gt;The code snippets referenced are meant solely to provide context for the discussion and are not intended to be run.&lt;/P&gt;
&lt;P&gt;I did change the text color of relevant snippets for clarity.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;CASLIB&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The caslib name can exceed 8 characters&lt;/P&gt;
&lt;P&gt;Example: &lt;FONT color="#0000FF"&gt;vhrf56789&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A caslib points to a ‘path’&lt;/P&gt;
&lt;P&gt;This path likely corresponds to a directory on the SAS Infrastructure Data Server (sometimes referred to as the “file system” or “file micro-service”).&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;caslib vhrf56789 sessref=CASAUTO datasource=(srctype="path")&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;path="/workspace/ ….. /viya_home_raw_files/";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;NOTE: 'VHRF56789' is now the active caslib.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;LIBREF&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Librefs (that point to the caslib) must follow the traditional SAS constraint of ≤ 8 characters.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;libname &lt;STRONG&gt;vhrf&lt;/STRONG&gt; cas caslib= VHRF56789;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;CASLIB vs LIBREF usage&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Caslib can be referenced directly inside any CASL (CAS language) statement&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc cas;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;table.fetch&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;table={caslib="&lt;STRONG&gt;VHRF56789&lt;/STRONG&gt;" name="table_test"};&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Libref must be utilized to reference the caslib outside of CASL&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data &lt;STRONG&gt;vhrf&lt;/STRONG&gt;.table_test_format;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;set &lt;STRONG&gt;vhrf&lt;/STRONG&gt;.table_test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;format var1 frmt.;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc print data= &lt;STRONG&gt;vhrf&lt;/STRONG&gt;.table_test_format noobs; run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;CAS format library names &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Empirically, can also exceed 8 characters&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc format casfmtlib="&lt;STRONG&gt;CASformats&lt;/STRONG&gt;"; &lt;FONT color="#993300"&gt;/* &amp;lt;&amp;lt;&amp;lt; lib=work.formats is implicit*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;value frmt&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;1 = 'abc';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;cas casauto listformats MEMBERS;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;NOTE: Fmtlib = &lt;STRONG&gt;CASFORMATS&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Scope = Session&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fmtsearch = YES&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Format = frmt&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These names appear to function more like metadata identifiers for the library that contains the underlying .sashdat format file&lt;/P&gt;
&lt;P&gt;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&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 14:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/caslib-vs-CAS-libref-CAS-format-library/m-p/978308#M378595</guid>
      <dc:creator>Rampsas1</dc:creator>
      <dc:date>2025-11-04T14:06:53Z</dc:date>
    </item>
  </channel>
</rss>

