builtins

addUserActionSetPath

Description

The addUserActionSetPath action adds a caslib to the user-defined action set search path. This allows the CAS server to find and load user-defined action sets from a specified caslib, making them available for execution in the current session.

builtins.addUserActionSetPath <result=results> <status=rc> / caslib="string";
Settings
ParameterDescription
caslibSpecifies the caslib to add to the search path for user-defined action sets.
Data Preparation View data prep sheet
Data Creation for Examples

The following code creates a local directory and a caslib named 'mycaslib' that points to this directory. This setup is necessary to demonstrate adding a path for user-defined action sets, although the action itself does not require data.

Copied!
1/* This action does not directly use
2data, but requires a caslib. We create one for the examples. */
3LIBNAME mycaslib "/cas/
4data/casuser";
5 

Examples

This example demonstrates how to add a caslib named 'mycaslib' to the search path for user-defined action sets. This enables the server to locate action sets stored in this caslib.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3 
4BUILTINS.addUserActionSetPath / caslib="mycaslib";
5RUN;
6 
Result :
The action adds 'mycaslib' to the search path. A confirmation message is typically displayed in the log, indicating the successful addition of the path.

This detailed example shows the complete process: 1) Define a simple user-defined action set. 2) Save it to a file within a caslib's directory. 3) Add that caslib to the search path using 'addUserActionSetPath'. 4) Load and execute an action from the newly available action set.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 /* Step 1: Define a simple action set and save it */
3 SOURCE myActions;
4 ACTION myEcho(string text);
5 PRINT "Echo: " || text;
6 endaction;
7 ENDSOURCE;
8 BUILTINS.actionSetFromTable / TABLE={name="myActions"} actionSet="myCustomActions";
9 
10 /* Step 2: Add the caslib to the search path */
11 BUILTINS.addUserActionSetPath / caslib="mycaslib";
12 
13 /* Step 3: Load and run the custom action */
14 BUILTINS.LOADACTIONSET / actionSet="myCustomActions";
15 myCustomActions.myEcho / text="Hello from custom action!";
16RUN;
Result :
The log will show the successful addition of 'mycaslib' to the search path, the loading of the 'myCustomActions' action set, and finally, the output 'Echo: Hello from custom action!' from the custom action.

FAQ

What is the purpose of the addUserActionSetPath action?
Which action set does addUserActionSetPath belong to?
What is the required parameter for the addUserActionSetPath action?
What is the CASL syntax for using the addUserActionSetPath action?

Associated Scenarios

Use Case
Standard Use Case: Onboarding a Data Scientist to a Shared Project

A data science team maintains a central CAS library ('ds_project_lib') containing custom-built action sets for recurring analyses (e.g., feature engineering, model validation). ...

Use Case
Complex Use Case: Managing Action Sets from Multiple Business Units

An enterprise architect needs to provide a user with access to action sets from three different departments: Finance, Marketing, and a core 'common' library. The system must be ...

Use Case
Boundary Case: Handling Invalid and Duplicate Path Definitions

A junior analyst is writing a setup script to configure their environment but makes some errors, such as referencing a non-existent caslib and adding the same valid path twice. ...