builtins addUserActionSetPath

Complex Use Case: Managing Action Sets from Multiple Business Units

Scénario de test & Cas d'usage

Business Context

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 able to resolve and load actions from all three sources.
About the Set : builtins

Fundamental CAS server system commands.

Discover all actions of builtins
Data Preparation

Create three distinct caslibs and a unique action set in each to simulate a multi-department environment.

Copied!
1/* Create directories and caslibs */
2%sysexec mkdir -p /cas/DATA/casuser/common_tools;
3%sysexec mkdir -p /cas/DATA/casuser/finance_tools;
4%sysexec mkdir -p /cas/DATA/casuser/mktg_tools;
5LIBNAME common_lib cas caslib='/cas/data/casuser/common_tools';
6LIBNAME finance_lib cas caslib='/cas/data/casuser/finance_tools';
7LIBNAME mktg_lib cas caslib='/cas/data/casuser/mktg_tools';
8 
9PROC CAS;
10 /* Common Action Set */
11 SOURCE commonCode; ACTION logMsg(string msg); PRINT 'LOG: ' || msg; endaction; ENDSOURCE;
12 BUILTINS.sourceToFile / code=commonCode, casout={caslib='common_lib', name='common.sas', replace=true};
13 
14 /* Finance Action Set */
15 SOURCE financeCode; ACTION calcInterest(double principal, double rate); PRINT 'Interest calculated.'; endaction; ENDSOURCE;
16 BUILTINS.sourceToFile / code=financeCode, casout={caslib='finance_lib', name='finance.sas', replace=true};
17 
18 /* Marketing Action Set */
19 SOURCE mktgCode; ACTION segment(string criteria); PRINT 'Segmentation run.'; endaction; ENDSOURCE;
20 BUILTINS.sourceToFile / code=mktgCode, casout={caslib='mktg_lib', name='marketing.sas', replace=true};
21RUN;

Étapes de réalisation

1
Add the three departmental caslibs to the search path in sequence.
Copied!
1PROC CAS;
2 BUILTINS.addUserActionSetPath / caslib='common_lib';
3 BUILTINS.addUserActionSetPath / caslib='finance_lib';
4 BUILTINS.addUserActionSetPath / caslib='mktg_lib';
5RUN;
2
Load all three action sets to confirm they are discoverable.
Copied!
1PROC CAS;
2 BUILTINS.LOADACTIONSET / actionSet='common';
3 BUILTINS.LOADACTIONSET / actionSet='finance';
4 BUILTINS.LOADACTIONSET / actionSet='marketing';
5RUN;
3
Execute one action from each action set to ensure they are all functional.
Copied!
1PROC CAS;
2 common.logMsg / msg='Starting analysis';
3 finance.calcInterest / principal=1000, rate=0.05;
4 marketing.segment / criteria='new_customers';
5RUN;

Expected Result


The server successfully adds all three caslibs to the search path. All three action sets ('common', 'finance', 'marketing') are loaded without error. Executing an action from each set produces the expected log messages, proving that the server can manage and utilize multiple user-defined action set paths simultaneously.