<?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 PROC CASUTIL cannot recognize libref in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/738968#M230580</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question regarding the use of a libref to a CAS library. In the code example below, I have a CAS library with a name that's longer than 8 characters. As a result, the library doesn't show up in SAS Studio when I assign libraries. To actively keep track of the available data while working in SAS Studio, I use a libname statement to bind a shorter libref to the CAS library. The shorter libref works fine when I use it in the data step. However, PROC CASUTIL somehow does not recognize the shorter libref. Instead, I get "&lt;SPAN&gt;ERROR: The caslib 'INFO' does not exist.".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate it if anyone could give me insight into why the shorter libref does not seem to work in PROC CASUTIL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname info cas caslib = infographics;

data info.test1;
	input_data = "02-2020"; output;
run;

data info.test2;
	set info.test1;
	format output_date monyy7.; 
	output_date = input(input_date, anydtdte7.);
run;

proc casutil;
	save casdata = "test2" incaslib  = "info"
		 casout  = "test2" outcaslib = "info" replace; &lt;BR /&gt;
	droptable casdata = "test2" incaslib = "info" quiet;

	load casdata = "test2.sashdat" incaslib  = "info"
		 casout  = "test2" 		   outcaslib = "info" promote;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I work on SAS Viya version 3.5 and SAS Studio version 5.2.&lt;/P&gt;</description>
    <pubDate>Tue, 04 May 2021 15:40:51 GMT</pubDate>
    <dc:creator>JianShen</dc:creator>
    <dc:date>2021-05-04T15:40:51Z</dc:date>
    <item>
      <title>PROC CASUTIL cannot recognize libref</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/738968#M230580</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question regarding the use of a libref to a CAS library. In the code example below, I have a CAS library with a name that's longer than 8 characters. As a result, the library doesn't show up in SAS Studio when I assign libraries. To actively keep track of the available data while working in SAS Studio, I use a libname statement to bind a shorter libref to the CAS library. The shorter libref works fine when I use it in the data step. However, PROC CASUTIL somehow does not recognize the shorter libref. Instead, I get "&lt;SPAN&gt;ERROR: The caslib 'INFO' does not exist.".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate it if anyone could give me insight into why the shorter libref does not seem to work in PROC CASUTIL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname info cas caslib = infographics;

data info.test1;
	input_data = "02-2020"; output;
run;

data info.test2;
	set info.test1;
	format output_date monyy7.; 
	output_date = input(input_date, anydtdte7.);
run;

proc casutil;
	save casdata = "test2" incaslib  = "info"
		 casout  = "test2" outcaslib = "info" replace; &lt;BR /&gt;
	droptable casdata = "test2" incaslib = "info" quiet;

	load casdata = "test2.sashdat" incaslib  = "info"
		 casout  = "test2" 		   outcaslib = "info" promote;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I work on SAS Viya version 3.5 and SAS Studio version 5.2.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 15:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/738968#M230580</guid>
      <dc:creator>JianShen</dc:creator>
      <dc:date>2021-05-04T15:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CASUTIL cannot recognize libref</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/747469#M234603</link>
      <description>&lt;P&gt;All of the PROC CASUTIL parameters referencing caslibs need the actual &lt;EM&gt;caslib&lt;/EM&gt; name - not the &lt;EM&gt;libref&lt;/EM&gt; you assigned to the caslib. PROC CASUTIL generated CAS action that run in CAS, so the program won't have access to any of the resources on the Compute Server when it executes. Using the actual caslib name for INCASLIB and OUTCASLIB should fix the problem.&amp;nbsp;Try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname info cas caslib = infographics;
data info.test1;
	input_data = "02-2020"; output;
run;
data info.test2;
	set info.test1;
	format output_date monyy7.; 
	output_date = input(input_date, anydtdte7.);
run;

proc casutil;
	save casdata = "test2" incaslib  = "infographics"
		 casout  = "test2" outcaslib = "infographics" replace; 
	droptable casdata = "test2" incaslib = "infographics" quiet;
	load casdata = "test2.sashdat" incaslib  = "infographics"
		 casout  = "test2" 		   outcaslib = "infographics" promote;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;May the SAS be with you!&lt;/P&gt;
&lt;P&gt;Mark&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 18:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/747469#M234603</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-06-11T18:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CASUTIL cannot recognize libref</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/747471#M234605</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there anyway to discover the CAS name for the libref that is created using the CAS engine?&lt;/P&gt;
&lt;P&gt;For example what does the PATHNAME() function return for the INFO libref in the example program?&lt;/P&gt;
&lt;P&gt;Or what information is available in the DICTIONARY.LIBNAMES or SASHELP.VLIBNAM?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let remote=%sysfunc(pathname(info));
proc casutil;
  save casdata = "test2" incaslib  = "&amp;amp;remote"
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jun 2021 19:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/747471#M234605</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-11T19:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CASUTIL cannot recognize libref</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/747617#M234691</link>
      <description>&lt;P&gt;Not to my knowledge. This code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cas mySession;
libname x cas caslib="casuser";
%put NOTE: %qsysfunc(pathname(x));
proc cas;
	session.sessionID;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Produces this output in the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;0 %put NOTE: %qsysfunc(pathname(x));
NOTE: &lt;STRONG&gt;f67a5830-2590-a14b-b399-958a8299e619&lt;/STRONG&gt;
81   proc cas;
82   session.sessionID;
83   quit;
NOTE: Active Session now MYSESSION.
{MYSESSION:Sun Jun 13 14:28:33 2021=&lt;STRONG&gt;f67a5830-2590-a14b-b399-958a8299e619&lt;/STRONG&gt;}
NOTE: PROCEDURE CAS used (Total process time):&lt;/PRE&gt;
&lt;P&gt;So you can see that PATHNAME is returning the UUID of the CAS session, not the caslib. Right-clicking on the library in SAS Studio and choosing Properties will show the same results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless there are caslib librefs in your SAS session that were&amp;nbsp;automatically assigned by the SAS Administrator, you would have to have assigned them in your code.&amp;nbsp;Librefs assigned with the CASLIB _ALL_ ASSIGN; statement will automatically match the caslib name. And for librefs individually assigned with LIBNAME statements, the association should be self-evident in the code...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May the SAS be with you!&lt;BR /&gt;Mark&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2021 14:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CASUTIL-cannot-recognize-libref/m-p/747617#M234691</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-06-13T14:38:44Z</dc:date>
    </item>
  </channel>
</rss>

