?>Array ( [lang] => de [id] => 142 )
Scénario de test & Cas d'usage
Für dieses Szenario ist keine SAS-Datentabelle erforderlich. Die Vorbereitung besteht aus dem konzeptionellen Vorhandensein einer externen C-Bibliothek, die die Preisfunktion enthält. Wir simulieren nur die Deklaration ihres Prototyps.
| 1 | /* Annahme: Eine kompilierte C-Bibliothek existiert und enthält eine Funktion wie: |
| 2 | double calculateDerivativePrice(const char* productId, double spotPrice, double volatility) { |
| 3 | // ... komplexe Preislogik ... |
| 4 | return 105.7; |
| 5 | } |
| 6 | */ |
| 1 | PROC CAS; |
| 2 | ACTION fcmpact.addPrototypes / |
| 3 | routineCode={"proto calculateDerivativePrice(char[*], double, double) link='c' return=double;"} |
| 4 | funcTable={name="financial_prototypes", caslib="casuser", replace=true} |
| 5 | saveTable=true; |
| 6 | RUN; QUIT; |
| 1 | PROC CAS; |
| 2 | TABLE.fileInfo / caslib="casuser", path="financial_prototypes.sashdat"; |
| 3 | RUN; |
| 4 | TABLE.fetch / TABLE={name="financial_prototypes", caslib="casuser"}; |
| 5 | RUN; QUIT; |
Die Aktion wird erfolgreich ausgeführt. Eine CAS-Tabelle mit dem Namen 'financial_prototypes' wird in der 'casuser'-Bibliothek erstellt und gespeichert. Die Fetch-Aktion zeigt, dass die Tabelle die unverschlüsselte Definition des Prototyps 'calculateDerivativePrice' enthält, die für die Verwendung in anderen CAS-Aktionen bereit ist.