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

Hi,

The following code is loaded the table (xx.sashdat) into CAS but not as in-memory table .

(this code we run in sas studo viya). 

DATA TEST;
INPUT A B;
CARDS;
1 2
2 3
;
RUN;
proc casutil ;
load data="TEST" outcaslib="public"
casout="MTEST";
run;

proc casutil ;
save casdata="MTEST" replace;
run;

 

anybody face this kind of problem?

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Hello,

 

I think you can make a new "ABC" libref pointing to the same CASLIB.

 

Like here :

caslib mydatt_cas_data datasource=(srctype="path") path="/tmp";
libname CAS abc caslib=mydatt_cas_data;

Then use ABC in PROC DATASETS.

 

Koen

View solution in original post

8 REPLIES 8
Mike_j
SAS Employee

Your proc casutil code with the load data option transfers SAS data from the SAS Compute Server (work library) to SAS Cloud Analytic Services (the public CAS library). You should find, that the MTEST is indeed loaded to in-memory located in the public cas library (though, it is only available for your cas session):

proc casutil ;
load data="TEST" outcaslib="public"
casout="MTEST";
quit;

 

In your next proc casutil, where you save the dataset, you will need to use the incaslib= option to point to your public dataset:

proc casutil;
save incaslib="public" casdata="MTEST" replace;
quit;

Your dataset is now saved to the same CAS library it's already in as a .SASHDAT file. More information can be found here: SAS Help Center: Syntax: PROC CASUTIL SAVE Statement

 

If you want to access the in-memory dataset from another cas session you will have to promote the table. That can for example be done like this:

proc casutil outcaslib="public";
	promote casdata="MTEST" incaslib="public";
quit;

I hope this solves your issues. 

 

vallsas
Pyrite | Level 9

Thank you very much for the information.

proc casutil outcaslib="public";

promote casdata="MTEST" incaslib="public";

quit;

 

 
proc casutil outcaslib="public";
	promote casdata="MTEST" incaslib="public";
quit;

after using the above code I can see the table has been loaded as in-memory table in the target cas library. but the problem is if I want to replace by executing the same code in sasstudio i am getting error as table already exist. 

ERROR: There is no session-scope table xxxx in caslib test_cas_data of could analytic services.

ERROR: The action stopped due to errors.

 

If I unlod the table by manually then run the above code of proc then table loaded as in-memory table.

 

I am confused how come the able in showing as in studo as in-memory table (with symbol) mycas of libraries .

on the same if I go  environment manager and tables then my cas library the able is only available .sashdat table, not as in-memory table copy.(as when we load the table two copies one physical .sashdat , and memory table as cas with same name).

 

 

sbxkoenk
SAS Super FREQ

Hello,

 

The PROMOTE statement copies a session-scope table to global scope.

Note: The PROMOTE statement does not include a REPLACE option. The server does not support promoting a session-scope table and replacing a global-scope table in one operation. You must drop the global-scope table first.

 

Hence, ... before replacing your table you can submit :

proc datasets library=PUBLIC NoList memtype=DATA;
	delete MTEST; run;
quit;

/* ** OR ** */
proc casutil incaslib="PUBLIC";
   droptable casdata="MTEST" quiet;
run;
/* end of program */

Best,

Koen

 
vallsas
Pyrite | Level 9
Thanks Koen,
proc datasets library=mydatt_cas_data NoList memtype=DATA;
delete MTEST; run;
quit;
ERROR : mydatt_cas_data is not valid name

i already creaed as pathbased library in cas as mydatt_cas_data where i used to save the all cas tables.


sbxkoenk
SAS Super FREQ

Hello,

 

I think you can make a new "ABC" libref pointing to the same CASLIB.

 

Like here :

caslib mydatt_cas_data datasource=(srctype="path") path="/tmp";
libname CAS abc caslib=mydatt_cas_data;

Then use ABC in PROC DATASETS.

 

Koen

vallsas
Pyrite | Level 9
Hi ,

little change in the order in the libaname
libname abc cas caslib=mydatt_cas_data;
but this time i have problem of saving table
proc casutil;
save casdata="xxxx" incaslib="xxxx" outcaslib="xxxx" casout="xxxx" replace;
quit;
ERROR: The action stopped due to errors
ERROR: Failed to save the table "xxxxx" from the "xxxx" caslib to the "xxxxx" caslib
here from and to caslibs are same.
🙂
vallsas
Pyrite | Level 9
hello Koen

please ignore my previous post it is working thank you .
sbxkoenk
SAS Super FREQ

@vallsas wrote:

Hi,

The following code is loaded the table (xx.sashdat) into CAS but not as in-memory table .

into CAS but not as in-memory table ??
That's a strange statement. I guess it's in-memory but not available to all users / CAS-sessions.

 

Promoting the table might be the solution !

See here :

SAS® 9.4 and SAS® Viya® 3.5 Programming Documentation | SAS 9.4 / Viya 3.5
CAS User’s Guide
CASUTIL Procedure
PROMOTE Statement
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/casref/p1742zxo50czfgn1czlo8w3w58mt.htm


Koen

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 2283 views
  • 3 likes
  • 3 in conversation