Restores a user-defined action set from a saved table. This is useful for sharing custom action sets or for persisting them across CAS sessions. You first need to save an action set using the `actionSetToTable` action.
| Parameter | Description |
|---|---|
| name | Specifies the name for the user-defined action set to be restored. |
| table | Specifies the in-memory table from which to restore the action set. This table must have been created previously using the `actionSetToTable` action. |
First, we need to define a simple action set and then save it to a CAS table. This table will then be used as the source to restore the action set. We'll define an action set named 'myCustomActionSet' with a simple 'hello' action, and save it to the 'myActionSetTable' table in the 'CASUSER' caslib.
| 1 | PROC CAS; |
| 2 | BUILTINS.defineActionSet / |
| 3 | name='myCustomActionSet', |
| 4 | actions={ |
| 5 | {name='hello', definition={ |
| 6 | parms={ |
| 7 | {name='name', type='string', description='Name to say hello to'} |
| 8 | }, |
| 9 | code="print('Hello, ' || name)" |
| 10 | }} |
| 11 | }; |
| 12 | RUN; |
| 13 | BUILTINS.actionSetToTable / |
| 14 | actionSet='myCustomActionSet', |
| 15 | TABLE={name='myActionSetTable', caslib='CASUSER', replace=true}; |
| 16 | RUN; |
| 17 | QUIT; |
This example demonstrates the basic use of the `actionSetFromTable` action. It restores the 'myCustomActionSet' action set from the 'myActionSetTable' table that was previously saved. The action set is restored with its original name.
| 1 | |
| 2 | PROC CAS; |
| 3 | BUILTINS.actionSetFromTable / TABLE={name='myActionSetTable', caslib='CASUSER'}; |
| 4 | |
| 5 | RUN; |
| 6 | |
| 7 | QUIT; |
| 8 |
This example shows how to restore a user-defined action set under a new name ('restoredSet') and then immediately verify its successful restoration by calling the `actionSetInfo` action. This is a common pattern to ensure the action set is ready for use and to avoid name conflicts.
| 1 | |
| 2 | PROC CAS; |
| 3 | BUILTINS.actionSetFromTable / TABLE={name='myActionSetTable', caslib='CASUSER'} name='restoredSet'; |
| 4 | |
| 5 | RUN; |
| 6 | BUILTINS.actionSetInfo / actionSet='restoredSet'; |
| 7 | |
| 8 | RUN; |
| 9 | |
| 10 | QUIT; |
| 11 |
An operations team has developed a standard set of utility actions (e.g., for custom logging, data quality checks) and saved it. A new analyst in a different CAS session needs t...
A data science team is developing a new version of a scoring algorithm. They need to load the new version ('scoringModel_v2') from the same saved table as the original ('scoring...
An automated script attempts to load a user-defined action set. The script must be robust enough to handle cases where the source table does not exist (e.g., it was not created ...