12.7 Variable Categories
You can use variable categories to help organize long lists of variable definitions in a tree. Use the Variables View to create a hierarchical structure of variables via variable categories.
The categories can be used both in the display of variable definitions in the tree window (under nodes), as well as in the Variables View.
We will use the Healthcare tutorial example BreachOfContract-Variables.trex, but you can follow these steps in any model. We will categorize the variables by their function within the model.
To create a variable category and assign variables to it:
-
Click the Show Categories Tree icon (right of the Clear button). The categories pane within the view will be displayed to the left of the variables list.
-
Click the "plus" icon in the categories pane. A new category "Category1" will be created.
-
Click the new category in the categories grid and rename it. In this case, enter "Probabilities".
-
Repeat the prior two steps to create the category "Values".
-
Click on a divider between columns for the variable pJudge_ConsDmg and drag the variable onto the category Probabilities.
-
Repeat to assign the remaining variables to the appropriate categories.
-
Click the Hide categories tree icon to close the left pane list.
-
Click the Group items by category icon to show all variables by category in the main list.
The variables have now all been categorized and the Variables View will present them in category groupings.
Note that you can also assign variables to categories in two other ways.
-
Choose a category from the dropdown list in the Variables View list.
-
Double-click on a variable to open the Add/Change Variable dialog, then choosing Categories in the left pane.
You can create a hierarchical structure of variable categories by creating subcategories within other categories using the "Add sub-category" icon in the categories pane. Variables can be assigned to one or more categories, regardless of each category's position in the hierarchy. To assign variables to sub-categories, drag the variable from the main window into the sub-category. The categories and sub-categories the variables are listed in will appear in the Category column in the main Variable View pane.
Categories for other inputs
Categories are most-commonly used for variables. However, other model inputs (distributions, trackers, tables) can also be categorized in the same way.
Variable Category Tree Preferences
The tree’s variables display preferences allow you to display variable definitions in the model by category. When checked, the tree shows categories for variable definitions under each node. The image below shows Tree Preferences, with the model in the background and the categories for Payoffs and Probabilities.
Variable Categories in the Variable Report
If variable categories are used in the model then the variable report will also show the categories including any subcategories, as in the Figure below.
If you select to "Group items by categories" in the Variable view before generating the Variable Report, the Variable Report will show the variables grouped by categories too.