Scénario de test & Cas d'usage
Execution of SAS FCMP functions within the CAS environment.
Discover all actions of fcmpactNo input data table is needed. This scenario focuses on registering the prototypes of two external C functions: `calculate_var` (Value at Risk) and `calculate_es` (Expected Shortfall). These functions are assumed to exist in a pre-compiled shared library.
| 1 | /* No |
| 2 | data step required. The test creates a prototype table directly. */ |
| 1 | PROC CAS; |
| 2 | fcmpact.addPrototypes |
| 3 | routineCode={ |
| 4 | "proto calculate_var(double, double, double) returns double;", |
| 5 | "proto calculate_es(double, double, double) returns double;" |
| 6 | }, |
| 7 | package="FinancialRiskLib", |
| 8 | funcTable={name="risk_models", caslib="casuser", replace=true}; |
| 9 | RUN; |
| 10 | QUIT; |
| 1 | PROC CAS; |
| 2 | TABLE.columnInfo TABLE={caslib="casuser", name="risk_models"}; |
| 3 | RUN; |
| 4 | QUIT; |
The `risk_models` table is successfully created in the `casuser` caslib. The `table.columnInfo` action should show the structure of the FCMP prototype table (_funcname_, _pkgname_, _language_, etc.), confirming that the definitions for `calculate_var` and `calculate_es` under the `FinancialRiskLib` package have been registered. The log will show a success message for the `addPrototypes` action.