builtins addUserActionSetPath

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

Scénario de test & Cas d'usage

Business Context

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). A new team member needs to configure their CAS session to access these shared tools.
About the Set : builtins

Fundamental CAS server system commands.

Discover all actions of builtins
Data Preparation

Create a directory, a caslib pointing to it, and a simple user-defined action set. This simulates the shared project environment.

Copied!
1/* Create a directory for the action set */
2%let act_set_path=/cas/DATA/casuser/ds_project;
3%sysexec mkdir -p &act_set_path;
4 
5/* Create the caslib */
6LIBNAME ds_project_lib cas caslib=&act_set_path;
7 
8PROC CAS;
9 /* Step 1: Define a simple action set named 'featureEng' */
10 SOURCE featureEngCode;
11 ACTION normalize(TABLE INPUT, string var, string OUTPUT);
12 PRINT 'Normalizing ' || var || ' from table ' || INPUT || ' into ' || OUTPUT;
13 /* Placeholder for actual normalization logic */
14 results = {note='Action executed successfully.'};
15 send_response(results);
16 endaction;
17 ENDSOURCE;
18 
19 /* Step 2: Save the action set definition to a file in the caslib's directory */
20 BUILTINS.sourceToFile / code=featureEngCode, casout={caslib='ds_project_lib', name='featureEng.sas', replace=true};
21RUN;

Étapes de réalisation

1
In a new session, attempt to load the custom action set. This should fail as the path is not yet known.
Copied!
1PROC CAS;
2 /* This will produce an error because the server doesn't know where to find 'featureEng' */
3 BUILTINS.LOADACTIONSET / actionSet='featureEng';
4RUN;
2
Add the shared project caslib ('ds_project_lib') to the user's action set search path.
Copied!
1 
2PROC CAS;
3BUILTINS.addUserActionSetPath / caslib='ds_project_lib';
4RUN;
5 
3
Retry loading the action set. It should now succeed.
Copied!
1 
2PROC CAS;
3BUILTINS.LOADACTIONSET / actionSet='featureEng';
4RUN;
5 
4
Execute the custom action from the loaded set to confirm full functionality.
Copied!
1 
2PROC CAS;
3featureEng.normalize / INPUT='mydata', var='age', OUTPUT='age_norm';
4RUN;
5 

Expected Result


The initial attempt to load the action set fails with an error. After 'addUserActionSetPath' is called, the action set loads successfully. The final call to the custom 'normalize' action executes and prints the expected message to the log, confirming the action set is fully operational.