BookmarkSubscribeRSS Feed

Debugging a task in SAS Solution for IFRS 17

Started ‎12-01-2023 by
Modified ‎03-27-2024 by
Views 538

Introduction

 

SAS Solution for IFRS 17 uses SAS Infrastructure for Risk Management job flows to perform various calculations and data processing activities.  The job flows are series of inter-related tasks. Each task is further based on SAS macros. These macros do all the basic work. These macros are executed at the backend in an automated manner via tasks in a job flow defined in SAS Infrastructure for Risk Management. The SAS system provides a flexibility of executing, testing, or debugging any macro specific to a task without re-executing the entire job flow.  The objective of the article is to provide developers and testers an overview of steps to execute, debug, or test a macro separately for a selected task from the defined job flows. The article assumes that you have a basic knowledge of SAS macro programing and a basic idea of tools like SAS Infrastructure for Risk Management and SAS Solution for IFRS 17.

 

If you are new to the topic, we recommend the following courses:

 

SAS Infrastructure for Risk Management Overview

 

Technical Overview of SAS Solution for IFRS 17 in SAS Risk Stratum

Steps to execute a task-based macro separately with debugging options.

 

You can follow a few simple steps to perform the testing. You must have a valid role or administrator level access to SAS Infrastructure for Risk Management and SAS Studio.

 

01_SB_SunBlog3b-1024x212.pngA high level overview of the series of steps.


Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

1. Access the job flow and task.

 

The first step is to access the job flow interface of SAS Infrastructure for Risk Management and locate the desired job flow and open it. Following are the steps:

 

  • Using the interface of SAS Infrastructure for Risk Management access the required job flow.
  • Double click to open it.
  • Zoom in on the required task and right-click and select Show Help.    


Following are some of the illustrations:


02_SB_SunBlog3c-1024x515.pnga. Illustration of list of job floe instances in SAS Infrastructure for Risk Management.

 

ModifiedSunilBlog3d.png

b. Illustration of Discounting cash flows job flow (partial view).   


04_SB_SunilBlog3e-1024x371.pngc. Illustration of a right-click on a specific task (Contract Enrichment). 

 

2. Identify the macro


When you select Show Help, the documentation corresponding to the task opens. Note that there are other support macros along with your main macro. For example, your main macro for the task Contract Enrichment is irmif_contracts_enric_undisc.sas or %irmif_contracts_enric_undisc whereas macros like %irmif_session_prepare or %irmif_determine_tgtlib are support macros. You must click ‘Go to the Source Code of the File’ to study the source code of the main and underlying parameters necessary for the execution of the macro.  


05_SB_SunilBlog3g-1024x495.pngIllustration of help documentation for the macro details. 


06_SB_SunilBlog3f-1024x492.pngIllustration of the source code and parameters for the main macro for the task.

 

3. Assign SASAUTOS (or Include init.sas file)

 

Login to a SAS Studio session. Using the Code tab, you will start developing your script. To begin with, you must define and call all the necessary autocall libraries.  This can be done by explicitly defining SASAUTOS options with all the necessary macro libraries. One of the other ways is to use the script init.sas specific to the cycle which has all the relevant settings and code for SASAUTOS embedded in it. It is in the appropriate workgroup folder assigned to your role. Following is an example of a code snippet used.

 

%include "D:\SAS\Config\Lev1\AppData\SASRiskWorkGroup\groups\Public\
SASRiskManagementCore\cycles\10039\init.sas";

/* This file init.sas has necessary code for assigning necessary
libraries using SASAUTOS option. The path is based on your assigned workgroup and settings at your site*/

OPTIONS NOTES STIMER SOURCE MPRINT SYNTAXCHECK.

/* Users must add options to get more details in the log for effective debugging. */

 

Note that %include statement is necessary to call in the script to your session. Notice that the number 10039 represents the current cycle ID. You should replace this number by your own cycle ID. You can get the cycle ID from the Cycle workspace of SAS Solution of IFRS 17. The options added have a very crucial role in debugging. These options are described briefly as follows:

 

Option Purpose
NOTES It prints notes for problem determination and resolution.
STIMER It prints system performance statistics
SOURCE It prints the message in the LOG file about how the macro variable is resolved.
MPRINT It prints all the SAS statements of the resolved macro code.
SYMBOLGEN It prints the values for all the resolved macro variables
SYNTAXCHECK It enables syntax check mode for statements that are submitted within a non-interactive or batch SAS session.

 

4. Create Instance-Specific Libraries

 

You must assign all the libraries used for input and output for the macro to be executed. The typical libraries are shown in the following lines.

 

libname disc_t_1 "D:\SAS\Config\Lev1\AppData\SASIRM\pa\data\ 201913016\disc_t_1";
libname disc_pre "D:\SAS\Config\Lev1\AppData\SASIRM\pa\data\ 201913016\disc_pre";
libname global "D:\SAS\Config\Lev1\AppData\SASIRM\pa\data\ 201913016\landing_area\base\global";
libname FW_STAGE "D:\SAS\Config\Lev1\AppData\SASIRM\pa\data\ 201913016\fw_stage";
libname FW_MKT "D:\SAS\Config\Lev1\AppData\SASIRM\pa\data\ 201913016\fw_mkt";
libname IC_STAT ("D:\SAS\Config\Lev1\AppData\SASIRM\pa\data\ 201913016\landing_area\base\ifrs17.v10.2021\static" "D:\SAS\Config\Lev1\AppData\SASIRM\fa.ifrs17.10.2021\irm\landing_area\base\ifrs17. v10.2021\static");
libname test "D:\SAS\Config\Lev1\AppData\SASIRM\test";
/* The last line defines the output library. */

 

The above lines of code defines all the instance-specific libraries. Notice the test library in the last line. This library will be used to write the output of the macro to be executed, tested and debugged. The actual instance library for the output is replaced by test to avoid any data overrides in the persistent area. The instance number (201913016) shown in the LIBNAME statements might be different for you. You must use the correct instance ID (or number) using the current and relevant version of instance Discounting cash flows  DDMMMYYYY_XXXXX_CXXXXX in SAS Infrastructure for Risk Management. You can find the number in the URL of the SAS Infrastructure for Risk Management instance when you open the instance.

 

5. Obtain Configuration Information


You can set the configurations you want to test in the relevant configuration tables like analytics_option, run_option, system_option, and so on. You can get the related list of configuration tables from the definition of the macro in the help documentation or from the job flow instance by carefully listing all the configuration related tables used as the input in the task.


The following portion lines shows the method and syntax to create macro variables that contain the configuration settings that can be used by the main task macro later:

 

data _null_; 
set ic_stat.run_option; 
call symputx(config_name,config_value); 
run;

data _null_; 
set ic_stat.analytics_option;
call symputx(config_name,config_value); 
run; 

data _null_; 
set global.system_option; 
call symputx(config_name,config_value);
run; 
/* The above data steps create macro variables. The SET statements in these data steps include the tables which have configuration options which you want to use and test. */ 

%put &BASE_DTTM.;
%put &entity_id.; 
%put &SCENARIO.; 
%put &REPORT_FREQUENCY.; 
%put %sysfunc(datepart(&BASE_DTTM.), DATE9.);
%put &DEPLOYMENT_SCENARIO.;
/* The above statement put the values of key settings or macro variables in the log. */

 

6. Call the Main Macro


In this step you call the main macro that is required for debugging or testing. In this example, the macro used is %irmif_contracts_enrich_disc. Notice the usage of the test library in the OUT_ parameters for the macro. Also, before you call the main macro, you should also call the support macros.

 

%irmif_session_prepare;

%irmif_determine_tgtlib(&DEPLOYMENT_SCENARIO.);

/* The above statements call the support macros. The macro 
%irm_session_prepare will use the values defined inside the RUN_OPTION
configuration table to prepare the SAS session.The %irmif_determine_tgtlib
macro determines which target library to load the data to based on the
deployment scenario*/ %irmif_contracts_enrich_undisc ( IN_MAP_CURVE = FW_MKT.MAP_CURVE, IN_DATA_IR_CURVE = FW_MKT.DISCOUNT_IR_CURVE_DETAIL, IN_MAP_RA_CARRIER = IC_MAP.MAP_RA_COC_DIV_FACTOR_CARRIER, IN_MAP_CF_LEGS = IC_MAP.MAP_UNIFIED_CASH_FLOW_LEG, IN_DATA_LIAB_CTRCT = FW_STAGE.INSURANCE_CONTRACT_GROUP, IN_DATA_LIAB_DETAIL = FW_STAGE.INSURANCE_CONTRACT_GROUP_DETL, IN_DATA_LIAB_CURVE = FW_STAGE.INSURANCE_CONTRACT_GROUP_X_CURVE, IN_DATA_LIAB_PORTFOLIO = FW_STAGE.INSURANCE_CONTRACT_PORTFOLIO, IN_DATA_LIAB_CTRCT_ASSOC = FW_STAGE.INSURANCE_CONTRACT_GROUP_ASSOC, IN_DATA_PREV_LIAB_CTRCT = FW_STAGE.PREV_INSURANCE_CONTRACT_GROUP, IN_DATA_PREV_LIAB_DETAIL = FW_STAGE.PREV_INSURANCE_CONTRACT_GROUP_DETL, IN_DATA_PREV_LIAB_CURVE = FW_STAGE.PREV_INSURANCE_CONTRACT_GROUP_X_CURVE, IN_DATA_PREV_LIAB_PORTFOLIO = FW_STAGE.PREV_INSURANCE_CONTRACT_PORTFOLIO, IN_DATA_PREV_LIAB_C_ASSOC = FW_STAGE.PREV_INS_CONT_GROUP_ASSOC, IN_DATA_CASHFLOWS = FW_STAGE.INSURANCE_CASHFLOW, PREV_IN_DATA_CASHFLOWS = FW_STAGE.PREV_INSURANCE_CASHFLOWS, IN_DATA_ENTITY = FW_STAGE.ENTITY, IN_DATA_PREV_ENTITY = FW_STAGE.PREV_ENTITY, IN_DECIMALS_CURR = IC_STAT.CURRENCY_DECIMAL, IN_DISCOUNTING_CONFIG = IC_STAT.DISCOUNTING_CONFIG, ENTITY = &ENTITY_ID., SCENARIO_ID = &SCENARIO., REPORTING_DT = %sysfunc(datepart(&BASE_DTTM.), DATE9.), REPORT_FREQUENCY = &REPORT_FREQUENCY., IN_MAT_DIM_MAX = &MAT_DIM_MAX., OUT_LIABILITY_CTRT = Test.ENRICHED_LIABILITY_CONTRACTS, OUT_ENRICHED_CASHFLOW = Test.ENRICHED_CASHFLOWS, OUT_ENRICHED_RISK_CAPITAL_CF =
Test.ENRICHED_RISK_CAPITAL_CASHFLOWS, OUT_DISCOUNTING_CONFIG = Test.DISCOUNTING_CONFIG, OUT_REINS_IR_CURVE = Test.REINS_IR_CURVE); /* In the above macro call, notice that the out parameters (OUT_ prefix) are all using Test library. */

 

7. Execute the script


Click Run to execute the script. Notice that there are no errors. SAS Studio provides a detailed log, which can be found by clicking the Log tab.

 

The log provides the details of any errors. There are several notes, warnings, and so on.


Developers and testers often have to interpret several messages in the log. For a better interpretation of logs refer to the courses SAS Macro Language 1: Essentials and SAS Macro Language 2: Advanced Techniques.

 

Conclusion 

 

The article presented a series of steps to test or debug a task-related macro by executing it separately from the job flow. These steps enable you to try out and test several configuration options and any customizations done based on your requirements. Such steps might be beneficial in the development and implementation stages of SAS Solution for IFRS 17. For a working demo of above steps refer to the course Technical Overview of SAS Solution for IFRS 17 in SAS Risk Stratum.

 

 

Find more articles from SAS Global Enablement and Learning here

 

Comments

I assume one only starts debugging after the task failed so there should be an execution log with all the information like cycle id and library paths. Is that a fair assumption?

@Patrick  Yes, its a fair assumption to have. When executing through user interface, you  spot an error on the SAS Infrastructure for Risk Management job flow interface. The interface displays the cycle ID, the specific task with error and ability to download the execution log by right-clicking the task and so on.  Thanks !

Version history
Last update:
‎03-27-2024 08:57 AM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags