The purpose of this post is to explain how a risk pipeline is used to perform risk analysis. I will identify the sequence of steps to follow to generated the results. We will also examine the risk methods that are available within SAS Risk Engine.
SAS Risk Engine provides a user interface that walks you through the process of performing risk analyses.
With the user interface, you can complete many of the same activities that can be accomplished through code, including:
defining risk method programs
creating risk method maps.
You use risk pipelines to create the risk environment, score counterparties, evaluate portfolios, and explore results.
Select any image to see a larger version. Mobile users: To view the images, select the "Full" version at the bottom of the page.
You begin with a risk pipeline, and you add functionality to the pipeline by adding nodes to it. Regardless of whether you use SAS Risk Engine through code or the user interface, several input tables are required to perform risk analyses. These tables need to be placed in memory in CAS before they can be used in a pipeline. Data nodes that add the portfolio data and market data to the pipeline are then configured.
The first step, creating a risk environment, is automatically created for you during pipeline execution. There are no actions that you need to take to complete this step.
Methods and maps are objects that you reference in your pipeline. Evaluation and scoring methods are created on the Risk Methods page. Maps are created from the Maps page. In the pipeline. You use action nodes to add these programs to the pipeline.
A method program consists of a set of computational statements that the risk engine uses to compute one or more output variables for specific types of objects in your portfolio data. Risk method maps show the relationship between risk methods and specific types of objects in your portfolio data.
After you configure a pipeline, all you need to do is submit the run to generate analysis results. The risk engine performs a few prerequisite tasks. Then it runs all the nodes in the pipeline sequentially.
You can review the results for the pipeline itself and for each node. You can explore tables in SAS Visual Analytics and in SAS Studio. And, depending on the configuration of the pipeline, results might be available for exploration in SAS Risk Explorer.
What are Risk Methods?
So now that we have discussed the Risk Pipeline creation process you can see one key portion of that process is the Risk Method Program. Let's look at the types of risk methods that are currently available from within SAS Risk Engine.
Basically, a risk method is SAS code that consists of a set of computational statements. The code defines one or more output variables for the objects in your portfolio data. A risk method consists of the method code and the objects that the method code references. Objects that the code references include risk data objects, output variables, and models to name a few.
For the method code, you enter SAS code that runs the computations for each instrument of a given type at each market state and horizon. If you plan to evaluate your portfolio or score your counterparties, you must create a risk method or a model group for each instrument type and counterparty type in your portfolio data.
Risk Method Types
Using the SAS Risk Engine user interface, you can create different types of risk methods. There are several more that can be incorporated when using SAS Risk Engine via code.
A computed method creates a single computed value that exists outside of the forecasted time horizons.
An evaluation method runs computations for each instrument of a given type at each market state and horizon. For credit risk, you could use an evaluation method to compute loan losses. For market risk, you could use an evaluation method to price trades. Here’s an example of a simple evaluation method that uses economic risk factors to evaluate and bin loans.
A mitigation method offsets exposures in your instrument data. You associate mitigants of a given type with a mitigation method.
PostVar methods calculate additional output variables after the regular variables and the evaluation method's output variables have been aggregated across sub-portfolios.
You use a PreQuery method to use output variables from your evaluation methods to calculate additional output variables in the Query Results node. These variables are not stored in the risk environment.
A scoring method runs computations for each counterparty of a given type at each market state and horizon. For credit risk, you might use a scoring method to compute the probability of default for your counterparties.
How are Output Variables used in Risk Pipelines?
Output variables are variables that the risk engine can use in downstream nodes in a risk pipeline and include in the analysis results. Did you know that the method code must explicitly state at least one output variable, with one exception? For cash flow analyses, you can specify output variables in the method code. You can also specify output variables in the Cash Flow Analysis section in the Evaluate Portfolio node. Or you can specify them in both places.
Output variables are used in risk method programs, evaluation model groups, and scoring model groups and in cash flow analyses. For now, we’ll focus on how to configure output variables.
First, you need to identify the output variables in your method code. The next step is to configure each variable according to its type. There are many options available in the user interface to configure your output variables. How you configure an output variable depends on the results that you want to produce. Is the output variable capturing value, exposure, or return among other possibilities?
When you create a new output variable, you first select a risk method type. You can select Evaluation, PostVar, PreQuery, or Scoring as the risk method type.
You also need to select a variable type. You can choose numeric, for which the output variable’s value is a single number. An array variable’s value is a one-dimensional array of numbers. If your output variable needs to contain the bucketed values of the cash flow, you would select a cash flow bucket array. Finally, select the cash flow measure type if the output variable’s value is either the duration or the convexity of the cash flows. For each variable type, there are optional fields to populate.
And there are up to three categories of configuration options available for your output variable. There are evaluation options, aggregation options, and post-aggregation options. So when you create an output variable, you first select the type of variable that it is. Then, when you are ready to configure the output variable, the options that are appropriate for the type are displayed and can be selected.
Suppose you have an output variable for profit and loss. The risk method type is Evaluation. You’d want to configure this variable to be calculated in a way that corresponds to how profit and loss is calculated and represented.
For this example, this type of output variable is typically configured so that an existing output variable is referenced as the base variable, the base case value is subtracted, and the tail statistics sign is flipped. So you would select those options. In the user interface, the configuration options for output variables are found under the categories that I just mentioned. Those categories are evaluation, aggregation, and post-aggregation. Each configuration option has a check box that you can select if you want to apply that option. You’ll see that some configuration options are selected by default.
The Output Variables page is where you access previously created output variables and where you create new ones. Output variables are global in scope and share the same definition across risk methods and model groups. And the variable’s name in the method code is the same as the output variable’s name.
Risk Engine ships with three output variables: VALUE, EXPOSURE, and PL (profit and loss). SAS has already created and configured these three commonly used output variables to save time and to remove any uncertainty about the way each should be configured. You cannot modify or delete them.
The Value output variable is automatically created when you run a pipeline that contains a risk method that sets the _VALUE_ system variable in its method code. But you will still need to add the VALUE output variable to your risk method.
Similarly, the Exposure output variable is automatically created for you when you run a pipeline that contains a mitigation map. Add the Exposure output variable to your risk method.
To Summarize
Your method code must explicitly set at least one output variable with the exception of Cash Flow Analyses, where you can specify output variables in the Cash Flow Analysis section in the Evaluate Portfolio node
You can select Evaluation, PostVar, PreQuery, or Scoring as the risk method type.
There are many options available in the user interface to configure your output variables. These options vary by type.
Output variables are global in scope and share the same definition across risk methods and model groups.
SAS has created and configured three commonly used output variables for you.
Finally, use the Output Variables page to view and manage output variables.
Find more articles from SAS Global Enablement and Learning here.
... View more