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.
Create a directory, a caslib pointing to it, and a simple user-defined action set. This simulates the shared project environment.
Copied!
/* Create a directory for the action set */\n%let act_set_path=/cas/data/casuser/ds_project;\n%sysexec mkdir -p &act_set_path;\n\n/* Create the caslib */\nlibname ds_project_lib cas caslib=&act_set_path;\n\nproc cas;\n /* Step 1: Define a simple action set named 'featureEng' */\n source featureEngCode;\n action normalize(table input, string var, string output);\n print 'Normalizing ' || var || ' from table ' || input || ' into ' || output;\n /* Placeholder for actual normalization logic */\n results = {note='Action executed successfully.'};\n send_response(results);\n endaction;\n endsource;\n\n /* Step 2: Save the action set definition to a file in the caslib's directory */\n builtins.sourceToFile / code=featureEngCode, casout={caslib='ds_project_lib', name='featureEng.sas', replace=true};\nrun;
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 */
6
LIBNAME ds_project_lib cas caslib=&act_set_path;
7
8
PROC CAS;
9
/* Step 1: Define a simple action set named 'featureEng' */
10
SOURCE featureEngCode;
11
ACTION normalize(TABLEINPUT, 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 */
In a new session, attempt to load the custom action set. This should fail as the path is not yet known.
Copied!
proc cas;\n /* This will produce an error because the server doesn't know where to find 'featureEng' */\n builtins.loadActionSet / actionSet='featureEng';\nrun;
1
PROC CAS;
2
/* This will produce an error because the server doesn't know where to find 'featureEng' */
3
BUILTINS.LOADACTIONSET / actionSet='featureEng';
4
RUN;
2
Add the shared project caslib ('ds_project_lib') to the user's action set search path.
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.