?> actionSetToTable - WeAreCAS
builtins

actionSetToTable

Description

The `actionSetToTable` action transforms a user-defined action set, which is a collection of custom operations, into a standard in-memory CAS table. This allows for the inspection, management, and storage of action set definitions using standard table manipulation tools. It is particularly useful for auditing, documenting, or programmatically analyzing custom actions available on the CAS server.

builtins.actionSetToTable / actionSet="action_set_name" casOut={name="table_name", caslib="caslib_name", ...};
Settings
ParameterDescription
actionSetSpecifies the name of the user-defined action set to be converted into a CAS table. This action set must already exist on the server.
casOutSpecifies the properties of the output table, such as its name, the caslib where it will be stored, and whether to replace an existing table with the same name.
Data Preparation
Defining a Custom Action Set

Before converting an action set to a table, one must first be defined. This code snippet creates a simple, user-defined action set named `myCustomActions` which includes a single action called `hello`. This action set will serve as the source for the `actionSetToTable` examples.

proc cas; action builtins.defineActionSet / name='myCustomActions' definition={{action='hello', parms={{name='name', type='string'}}, code='print("Hello, " .. _parms_["name"]);'}}; run; quit;

Examples

This example demonstrates the fundamental use of `actionSetToTable`. It takes the user-defined action set `myCustomActions` and converts its definition into a new CAS table named `actions_definition_table` within the `casuser` caslib.

SAS® / CAS Code
Copied!
1PROC CAS; ACTION BUILTINS.actionSetToTable / actionSet='myCustomActions' casOut={name='actions_definition_table', caslib='casuser'}; RUN; ACTION TABLE.fetch / TABLE='actions_definition_table'; RUN; QUIT;
Result :
The CAS server creates a new table named `actions_definition_table` in the `casuser` caslib. A `fetch` action on this table would display its content, which includes columns detailing the name, parameters, and source code of the actions within the `myCustomActions` action set.

In scenarios where you might be updating an action set and need to refresh its corresponding definition table, the `replace=true` option is essential. This example converts the `myCustomActions` action set and ensures that if a table named `actions_definition_table` already exists, it will be overwritten with the new definition.

SAS® / CAS Code
Copied!
1PROC CAS; ACTION BUILTINS.actionSetToTable / actionSet='myCustomActions' casOut={name='actions_definition_table', caslib='casuser', replace=true}; RUN; ACTION TABLE.fetch / TABLE='actions_definition_table'; RUN; QUIT;
Result :
The action creates or replaces the `actions_definition_table` in the `casuser` caslib. The `fetch` action then returns the contents of this newly created or updated table, reflecting the current definition of the `myCustomActions` action set.

This example demonstrates how to make the resulting table globally accessible to all subsequent CAS sessions by using the `promote=true` option. This is useful when the action set definition needs to be shared or referenced across different user sessions or applications without reloading it each time.

SAS® / CAS Code
Copied!
1PROC CAS; ACTION BUILTINS.actionSetToTable / actionSet='myCustomActions' casOut={name='actions_definition_table', caslib='casuser', promote=true}; RUN; ACTION TABLE.tableInfo / name='actions_definition_table'; RUN; QUIT;
Result :
A global-scope table named `actions_definition_table` is created. The `tableInfo` action confirms its existence and shows its scope as 'Global', meaning it will persist after the current session ends and be available to other sessions.

FAQ

What is the purpose of the `builtins.actionSetToTable` action?
What is the required parameter for the `actionSetToTable` action?
What does the `casOut` parameter specify in the `actionSetToTable` action?

Associated Scenarios

Use Case
Governance Scenario: Auditing Custom Analytical Actions

A financial services company must maintain a queryable inventory of all custom analytical functions deployed on the CAS server. This is required for regulatory compliance and in...

Use Case
CI/CD Scenario: Managing Action Set Updates and Lifecycle

A data science team maintains a 'recommendationEngine' as a CAS action set. This engine is updated frequently. A CI/CD pipeline must be able to redeploy the action set and overw...

Use Case
Edge Case Scenario: Handling Non-Existent Action Sets

A user is attempting to document a custom action set but makes a typo in the name. The system must be robust enough to handle this user error gracefully by reporting that the ac...