?>Array ( [lang] => en [id] => 37 ) Governance Scenario: Auditing Custom Analytical Actions - WeAreCAS
builtins actionSetToTable

Governance Scenario: Auditing Custom Analytical Actions

Scénario de test & Cas d'usage

Business Context

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 internal governance to track what custom logic is available, who created it, and what parameters it uses.
Data Preparation

Create a sophisticated, user-defined action set for financial analysis containing multiple actions with different parameters. This simulates a real-world collection of custom tools.

Copied!
1PROC CAS;
2ACTION BUILTINS.defineActionSet /
3 name='financeAnalytics'
4 definition={{
5 ACTION='calculateRisk',
6 parms={{name='clientId', type='int'}, {name='loanAmount', type='double'}},
7 code='print("Calculating risk for client " .. _parms_["clientId"]);'
8 }, {
9 ACTION='customerSegment',
10 parms={{name='demographicsTable', type='table'}},
11 code='print("Segmenting customers from TABLE " .. _parms_["demographicsTable"].name);'
12 }};
13RUN;
14QUIT;

Étapes de réalisation

1
Convert the 'financeAnalytics' action set into a CAS table named 'ANALYTICS_INVENTORY' for auditing purposes.
Copied!
1PROC CAS;
2ACTION BUILTINS.actionSetToTable /
3 actionSet='financeAnalytics'
4 casOut={name='ANALYTICS_INVENTORY', caslib='casuser'};
5RUN;
6QUIT;
2
Fetch the contents of the newly created inventory table to verify that both custom actions have been correctly documented.
Copied!
1PROC CAS;
2ACTION TABLE.fetch /
3 TABLE='ANALYTICS_INVENTORY';
4RUN;
5QUIT;

Expected Result


The action successfully creates the 'ANALYTICS_INVENTORY' table. The subsequent fetch action returns a table with two rows, where each row details one of the actions ('calculateRisk', 'customerSegment') from the 'financeAnalytics' action set, including their respective parameters and definitions.