Hello,
I have created a data set in the academic cas library in SAS Viya for learners using a data step (i also promoted it). I want to replace the data set with a new one. How can i delete it from the academic cas?
Thanks in advance,
Andreas
With regards to how to delete a table from a CAS library, I'd recommend you look at PROC CASUTIL, specifically the DROPTABLE function. https://go.documentation.sas.com/doc/en/vdmmlcdc/1.0/casref/p14fpceaxx8pz9n1id0wrgj92mrt.htm
When a table is promoted in CAS it is a global scope table, CAS does not allow you to implicitly replace the dataset to protect the dataset. That said, if you need to replace the data all you need to do is add the REPLACE option.
Here is some simple example code:
*Add CASLIB to session;
libname casuser cas;
*Load data into CAS;
data casuser.cars(promote=yes);
set sashelp.cars;
run;
*Replace data using datastep;
data casuser.cars(replace=yes);
set sashelp.cars(where=(make='Audi'));
run;
*Drop table using PROC CASUTIL;
proc casutil;
droptable casdata='cars' incaslib='casuser';
run;
*Test table does not exist;
proc print data=casuser.cars;run;
Hope this helps
Thanks,
Harry
With regards to how to delete a table from a CAS library, I'd recommend you look at PROC CASUTIL, specifically the DROPTABLE function. https://go.documentation.sas.com/doc/en/vdmmlcdc/1.0/casref/p14fpceaxx8pz9n1id0wrgj92mrt.htm
When a table is promoted in CAS it is a global scope table, CAS does not allow you to implicitly replace the dataset to protect the dataset. That said, if you need to replace the data all you need to do is add the REPLACE option.
Here is some simple example code:
*Add CASLIB to session;
libname casuser cas;
*Load data into CAS;
data casuser.cars(promote=yes);
set sashelp.cars;
run;
*Replace data using datastep;
data casuser.cars(replace=yes);
set sashelp.cars(where=(make='Audi'));
run;
*Drop table using PROC CASUTIL;
proc casutil;
droptable casdata='cars' incaslib='casuser';
run;
*Test table does not exist;
proc print data=casuser.cars;run;
Hope this helps
Thanks,
Harry
Unfortunately there seem a misunderstanding in the given example.
The proc print works fine en does not give an error at all!
This is because the second cars-table is a not a global-scope cas-table but a session-scope cas-table! The cas-table is therefore not replaced. The drop-table statement drops the session-scope table. The unalterd global-scope table still exists!!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.