fcmpact addPrototypes

Standard Integration of External C Functions for Financial Modeling

Scénario de test & Cas d'usage

Business Context

A financial institution needs to integrate its proprietary, high-performance C-based risk calculation algorithms into its SAS Viya environment. This scenario tests the basic registration of these external function prototypes into a CAS table for use in subsequent risk analysis steps.
About the Set : fcmpact

Execution of SAS FCMP functions within the CAS environment.

Discover all actions of fcmpact
Data Preparation

No 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.

Copied!
1/* No
2data step required. The test creates a prototype table directly. */

Étapes de réalisation

1
Define prototypes for `calculate_var` and `calculate_es` and store them in a CAS table named `risk_models` within a specific package.
Copied!
1PROC 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};
9RUN;
10QUIT;
2
Verify the creation and content of the prototype table `risk_models` by listing its columns.
Copied!
1PROC CAS;
2 TABLE.columnInfo TABLE={caslib="casuser", name="risk_models"};
3RUN;
4QUIT;

Expected Result


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.