BookmarkSubscribeRSS Feed
Zengahoe
Calcite | Level 5

Hi

I am trying to unload a table from memory in the caslib.  For Develop SAS Code

the code is 

 

------------------

/*Connecting to EAPG Resale Daily caslib */
LIBNAME TEST cas caslib="TEST FOLDER" DATALIMIT=ALL;
option DBIDIRECTEXEC;

 

proc sql;
drop table TEST.TEST_SORT
;
quit;

-----------------------------

Is it possible to use Prepare Data CASL option?

----------------

loadActionSet 'fedSql';
queryCode='drop table "'||_dp_inputCaslib||'"."TEST_SORT" {options force=true} ';

print queryCode;
ExecDirect / query=queryCode;

-------------

I try to run the prepare data query, the error is TEST_SORT cannot be found under the caslib.  Please help.  Thanks.

 

 

4 REPLIES 4
SASKiwi
PROC Star

The CASUTIL DROPTABLE statement is one way of doing this.

Zengahoe
Calcite | Level 5

Hi 

I am trying to use Prepare Data method instead of Develop SAS code method.  I am not sure how to code under CASL options

Panagiotis
SAS Employee

I don't really use the Prepare data application, but it seems like dropping tables with it is not appropriate. The reason being is it's creating a bunch of stuff behind the scenes that the next transformation needs. So when you drop a table the next transformation most likely will try to use it.

 

I went ahead and tested this. Here is the code to do the task. The easiest way with CASL code is the table.dropTable action: https://go.documentation.sas.com/doc/da/pgmsascdc/v_043/caspg/cas-table-droptable.htm?fromDefault=

 

 

/* Create a copy of the input table to the output table.                   */
/* This statement should be replaced by the actual code you intend to run. */
table.dropTable name='your_table_name' caslib='your_caslib' quiet=true;

While this code works, after you run it in the transform it returns an error. My guess is after it drops the table the application is trying to create references to the table for the next transformation. Since you dropped the table it can't make those behind the scenes references. That's my guess. You can test it.

 

If you are trying to build out a pipeline you can go to Develop Code and Flows  and use SAS Studio flows. There are a variety of point and click steps you can use there for pretty much anything you need. You can also use variety of coding languages (SAS/SQL/CASL/Python). 

 

Here is a quick tutorial to flows: Build Flows with SAS Studio

 

 

 

Zengahoe
Calcite | Level 5

Thanks.  Will try it out.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 793 views
  • 0 likes
  • 3 in conversation