BookmarkSubscribeRSS Feed
Austin9462
SAS Employee

Under the hood, the SAS Model Implementation Platform (MIP) is generating SAS High-Performance Risk (HP Risk) code. MIP handles as much of the process logic automatically for you, but there is some logic that is impossible to auto-generate, namely the model logic. This is where the User-Defined Logic (UDL) comes into play. Here, a MIP user implements their model logic using HP Risk code to be executed on loans or counterparties.

 

There are several out-of-the-box capabilities of the system to assist the user including system variables and functions, code blocks, internal looping over scenarios -> simulations -> horizons, and the ability to control the horizons in which the processing of a loan/counterparty occurs. Each of these capabilities exist to help the user maximize the performance of their implementation. By controlling the horizons in which the processing of a loan/counterparty occurs, the user can eliminate needless processing and significantly reduce the run-time of the implementation. What situations can such needless processing be eliminated?

 

There are several possible use cases:

1. The user is running a Monte Carlo model and the loan has gone to a terminal state in a particular simulation.

 

if (< condition indicating Default >) then _terminate_rep_ = 1;

 

2. The loan has reached the end of its term and/or has fully amortized .

 

if (LoanAge + simulationHorizon = LoanTerm) or (Updated_Bal <= 0) then _terminate_rep_ = 1;

 

3. The loan is a synthetic, new origination loan on the portfolio and has not reached its origination date in the forecast.

 

if (intnx("month",Origination_Date,0,'S') < intnx("month",_DATE_,0,'S')) then return;

 

4. The loan is a synthetic, new origination loan on the portfolio that is scenario specific.

 

beginblock INIT;
        length scen $32;
        < Portfolio Initialization Logic >
endblock;

beginblock LOAN_INIT;
        < Loan-Specific Initialization Logic >
endblock;

beginblock MAIN;
        if simulationHorizon = 0 then return;
        if simulationHorizon = 1 then do;
                call state_info('AnalysisName',scen);
                if (upcase(scen) ne upcase(Loan_Scenario_Variable)) then do;
                        _terminate_rep_ = 1;
                        return;
                end;
                < Initialize Temporary UDL Variables >
        end;
        < Implementation Logic for Every Horizon >
        _VALUE_ = 1;
endblock;

 

5. The loan does not need to be processed in a particular horizon such as the snapshot date.

 

if simulationHorizon = 0 then return;

 

Notice that in each of these situations, the user was able to control the horizons in which the loan is being processed in with the return statement, the system variable _terminate_rep_, or both. The return statement and _terminate_rep_ are available for use in both scoring and evaluation model groups.

 

The return statement allows the user to end the processing of the current horizon for that loan/counterparty. By setting the _terminate_rep_ system variable equal to one, the processing of any future horizons in a Monte Carlo simulation will be prevented and the next simulation will begin. If the model you're working with is not Monte Carlo, the processing of any future horizons in that scenario will be prevented and the next scenario will begin. A combination of the two can be used in the event you want to end the processing of future horizons and the current one as shown in (4). Note that any output variables defined after a return statement or any output variable in a future horizon skipped due to _terminate_rep_ = 1 will be set to zero.

 

The SAS Model Implementation Platform is designed to make the creation of your implementation and the implementation itself as fast as we can make it. By controlling the horizons in which a loan/counterparty is processed, the user can eliminate needless processing where possible to increase the performance of their implementation. Please leave a comment below if you have any questions or feedback on this functionality.