?>Array ( [lang] => fr [id] => 19 )
Scénario de test & Cas d'usage
Création d'un jeu d'actions 'scoringModel' avec une action 'predictRisk' qui calcule un score simple. Ce jeu d'actions est ensuite sauvegardé dans la table 'scoringModelTable' dans la caslib CASUSER.
| 1 | PROC CAS; |
| 2 | BUILTINS.defineActionSet |
| 3 | name='scoringModel', |
| 4 | actions={ |
| 5 | { |
| 6 | name='predictRisk', |
| 7 | parms={ {name='age', type='int'}, {name='revenue', type='double'} }, |
| 8 | script='score = (revenue / 10000) - (age / 10); send_response({_score_=score})' |
| 9 | } |
| 10 | }; |
| 11 | |
| 12 | BUILTINS.actionSetToTable |
| 13 | name='scoringModel', |
| 14 | TABLE={name='scoringModelTable', caslib='CASUSER', replace=true}; |
| 15 | QUIT; |
| 1 | PROC CAS; |
| 2 | BUILTINS.actionSetFromTable |
| 3 | name='productionScoring' |
| 4 | TABLE={caslib='CASUSER', name='scoringModelTable'}; |
| 5 | RUN; |
| 1 | productionScoring.predictRisk / age=35 revenue=85000; |
| 2 | RUN; |
| 3 | QUIT; |
L'action 'predictRisk' s'exécute avec succès et retourne un résultat de scoring. Le log SAS affiche le score calculé (dans cet exemple : 8.5 - 3.5 = 5.0), ce qui prouve que le jeu d'actions a été correctement restauré et est fonctionnel.