BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
marathon2
Fluorite | Level 6

I cannot see all the tables inside a caslib I already created on the Viya GUI. 

 

When I click on "Manage Environment" -> "Data" -> "Data Sources" -> the appropriate server name -> the specific caslib of interest, I can see all the unloaded tables within that caslib, as well as the caslib's attributes (e.g. name, description, server, source type, personal, odbc dsn, schema, catalog, authetication domain).

 

However, when I try listing all the tables inside the caslib in the code editor (see codes below) or use the Viya GUI ("SAS Develop Codes" -> "Libraries" -> the caslib of interest), I see no tables listed: 

libname mycas cas caslib="CAS_LIB_OF_INTEREST";
proc datasets lib=mycas;
run;

 

In fact, in the log, I get "WARNING: No matching members in directory."  Could you please let me know what's happening?

 

Observation 1. I will get the following, after running caslib "CAS_LIB_OF_INTEREST" list; 

NOTE: Session = MYSESSION Name = CAS_LIB_OF_INTEREST
Type = odbc
Description =
Path =
Definition = authenticationDomain = 'NZAuth'
Subdirs = No
Local = No
Active = No
Personal = No
Definition = catalog = '*'
Definition = odbc_dsn = 'ODBC_DSN_OF_INTEREST'
Definition = schema = 'SCHEMA_OF_INTEREST'
 
Observation 2. I also loaded the tables in memory:
proc casutil;
load casdata="TABLE_OF_INTEREST" incaslib="SOME_CASLIB"
outcaslib ="myCaslib" casout ="TABLE_OF_INTEREST" replace;
quit;
 
NOTE: Cloud Analytic Services made the external data from TABLE_OF_INTEREST available as table
TABLE_OF_INTEREST in caslib myCaslib.
NOTE: The Cloud Analytic Services server processed the request in 16.096784 seconds.
86 quit;
NOTE: PROCEDURE CASUTIL used (Total process time):
real time 16.43 seconds
cpu time 2.37 seconds
1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Within a CASlib there are two areas for data:

  • the physical area, this is where you see files like .sashdat files or DBMS tables, this is referred to as files no matter the type of source
  • the in memory area, so a file loaded in to memory, this is referred to as table

Using the CAS libname engine you can only see the tables (data loaded into memory) but not the files.

 

To have a look at both, you can use the code below:

proc casutil incaslib="Public";
list files;
list tables;
quit;

The way you loaded the data into memory created a session scope table, so it is only visible to the specific CAS session that created the data.

 

To create a global scope table (promoted table) use this code sample:

proc casutil ;
  /* need to drop a global scoped table */
  droptable incaslib="Public" casdata="cars" quiet;
  /* now load the table, in this we use a SAS data set */
  load data=sashelp.cars outcaslib="Public" casout="cars" promote;
quit;

View solution in original post

3 REPLIES 3
BrunoMueller
SAS Super FREQ

Within a CASlib there are two areas for data:

  • the physical area, this is where you see files like .sashdat files or DBMS tables, this is referred to as files no matter the type of source
  • the in memory area, so a file loaded in to memory, this is referred to as table

Using the CAS libname engine you can only see the tables (data loaded into memory) but not the files.

 

To have a look at both, you can use the code below:

proc casutil incaslib="Public";
list files;
list tables;
quit;

The way you loaded the data into memory created a session scope table, so it is only visible to the specific CAS session that created the data.

 

To create a global scope table (promoted table) use this code sample:

proc casutil ;
  /* need to drop a global scoped table */
  droptable incaslib="Public" casdata="cars" quiet;
  /* now load the table, in this we use a SAS data set */
  load data=sashelp.cars outcaslib="Public" casout="cars" promote;
quit;
marathon2
Fluorite | Level 6

Thank you! I am trying to promote the table. However, I got an error saying I can't promote the table because I am working in a local session. So I added an extra argument in red, which gave me an error (ERROR: The CASLIB statement = parameter is invalid or missing. Correct the statement parameter). 

 

%LET caslib_path = "/disk/path...";
caslib myCaslib datasource=(srctype="path") path=&caslib_path sessref=mySession LIBREF= myCaslib local= No;

 

However, running the above codes gave me an error: 

/*4. load data into memory*/
proc casutil;
load casdata="TABLE_OF_INTEREST" incaslib= "MyCaslib"
outcaslib = "OUT_CASLIB_NAME" casout ="TABLE_OF_INTEREST"  promote;
run;

 

*errors are as below;

ERROR: You cannot promote an output table to a session-local caslib.
ERROR: The action stopped due to errors.
BrunoMueller
SAS Super FREQ
In your first post you mentioned that you already created the caslib, there is not need to create the caslib again using the CASLIB statement. The CASLIB statement has the options SESSION (default) to create a session caslib or GLOBAL to create a global scope caslib. To promote a table the target caslib has to have a global scope.

Please note, by default only SASAdministrators can create global scoped caslibs.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Discussion stats
  • 3 replies
  • 3420 views
  • 0 likes
  • 2 in conversation