TREESPLIT Procedure

PROC TREESPLIT Statement

  • PROC TREESPLIT <options>;

The PROC TREESPLIT statement invokes the procedure. Table 1 summarizes the options in this statement.

Table 1: PROC TREESPLIT Statement Options

Option Description
Basic Options
APPLYROWORDER Specifies that the procedure use a prespecified data distribution
BINMETHOD= Specifies how to bin interval inputs prior to training
CVCC Requests a table of the results of the cost-complexity pruning based on cross validation
INMODEL= Specifies a saved tree model to use to score a new table
NOPRINT Suppresses ODS output
NTHREADS= Specifies the number of threads to use in the computation
NUMBIN= Specifies the number of bins to use for continuous variables
OUTMODEL= Specifies the data table to which the decision tree model is to be saved
PLOTS= Specifies options for plots
PRINTTARGET Create tables that contain information about columns in the output
PRUNINGTABLE Creates a table that contains the pruning information
RBAIMP Creates a variable importance table by using random branch assignment
SEED= Sets the seed for pseudorandom number generation
TREEPLOT Creates a table that contains the information used to render the tree graphics
VII= Calculates the importance of the specified types of variable interactions
Splitting Options
ASSIGNMISSING= Specifies how to handle missing values in a predictor variable
CLUSTERSPLIT Requests that an alternative method of determining splits be used
MAXBRANCH= Specifies the maximum number of child nodes per parent node
MAXDEPTH= Specifies the maximum tree depth
MINLEAFSIZE= Specifies the minimum number of observations per child node
MINUSEINSEARCH= Specifies the minimum number of observations to use with the USEINSEARCH policy for handling missing values
NOMSEARCH= Specifies the method to use to find a split on a nominal variable
SPLITONCE Specifies that a variable can be used to split only once per branch


You can specify the following options:

APPLYROWORDER

uses a data distribution and row order as determined by a previous partition action call. For more information, see the section The APPLYROWORDER Option in Chapter 2, Shared Concepts.

ASSIGNMISSING=BRANCH |NONE |MACSMALL |POPULAR |SIMILAR |USEINSEARCH

specifies how to handle missing values of predictor variables during training and how to handle missing values and unknown levels of predictor variables. An unknown level of a categorical predictor variable is a level that does not exist in the training data but is encountered during scoring. During scoring, unknown levels are treated as missing values.

You can specify one of the following values:

BRANCH

during the training phase, assigns any observation that has a missing value for the predictor variable to a specially created child node (branch). If all observations have nonmissing values for a predictor variable, then no branch is created to contain observations with missing values. In the scoring phase, if an observation has a missing value for a predictor variable and no special branch was created to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.

NONE

during the training phase, excludes any observation that has a missing value for any predictor variable. In the scoring phase, if an observation has a missing value or an unknown level for a categorical predictor variable, then the observation is assigned to the child node that contains the most training observations. If an observation has a missing value for a continuous predictor, then the observation is assigned to the child node with the smallest numerical values of the predictor.

MACSMALL

during the training phase, treats a missing value in a categorical predictor variable as a separate, legitimate value. If all observations have nonmissing values for a categorical predictor variable, then no branch is selected to contain observations with missing values. In the scoring phase, if an observation has a missing value for a categorical predictor variable and no branch is selected to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.

In both the training and the scoring phases, missing values in continuous predictor variables are treated as the smallest possible value.

POPULAR

during the training phase, assigns any observation that has a missing value in the predictor variable to the child node that has the most training observations. In the scoring phase, if an observation has a missing value or an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.

SIMILAR

during the training phase, assigns any observation that has a missing value in the predictor variable to the child node whose observations are most similar to it. This similarity is determined using the chi-square criterion for categorical responses or the F-test criterion for continuous responses. If all observations have nonmissing values for a predictor variable, then no branch is selected to contain observations with missing values. In the scoring phase, if an observation has a missing value for a predictor variable and no branch is selected to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.

USEINSEARCH

during the training phase, treats a missing value in a predictor variable as a separate, legitimate value. If all observations have nonmissing values for a predictor variable, then no branch is selected to contain observations with missing values. In the scoring phase, if an observation has a missing value for a predictor variable and no branch is selected to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.

By default, ASSIGNMISSING=USEINSEARCH.

BINMETHOD=BUCKET |QUANTILE

specifies how to bin interval input variables prior to growing the decision tree. The number of bins that are created is determined by the NUMBIN= option.

You can specify one of the following values:

BUCKET

bins interval input variables into fixed-width bins. The width of each bin for a particular variable is calculated by subtracting the smallest value among all observations from the largest value among all observations, and then dividing that result by the number of bins.

QUANTILE

bins interval input variables into bins according to their quantile. The width of the bins for a particular variable is not fixed, but the number of observations in each bin is approximately equal.

By default, BINMETHOD=QUANTILE.

CLUSTERSPLIT

determines the splits at each node using clustering on each input variable, and then chooses the splitting variable on the basis of which variable and split optimize the criterion that is specified in the GROW statement.

CVCC
CVCOSTCOMPLEXITY

requests a table of the results of cost-complexity pruning based on cross validation. For each penalty parameter in the cross validation, the table provides the penalty parameter, the minimum, the maximum, and the average error. The error is the misclassification rate when the response variable is categorical and is the average square error (ASE) when the response variable is continuous. You can use the PLOTS=CVCC option to request a plot of the information in this table.

DATA=libref.data-table

names the input data table for PROC TREESPLIT to use. libref.data-table is a two-level name, where

libref

refers to a collection of information that is defined in the LIBNAME statement and includes the library, which includes a path to the data, and a session identifier, which defaults to the active session but which can be explicitly defined in the LIBNAME statement. For more information about libref, see the section Using CAS Sessions and CAS Engine Librefs.

data-table

specifies the name of the input data table.

INMODEL=<libref.>data-table

specifies the data table that you have previously saved as a tree model by using the OUTMODEL= option in a previous run of PROC TREESPLIT. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the input data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

When you use the INMODEL= option, the OUTPUT statement is required and any other options in the PROC TREESPLIT statement, except for NOPRINT and PLOTS, are ignored.

The data table used in the INMODEL= option must include the attributes that are associated with the table produced by the OUTMODEL= option, or PROC TREESPLIT issues an error.

MAXBRANCH=b

specifies the maximum number of child nodes per parent node in the tree. PROC TREESPLIT tries to create this number of children unless it is impossible (for example, if a split variable does not have enough levels).

By default, MAXBRANCH=2.

MAXDEPTH=number

specifies the maximum depth of the tree to be grown. The number of levels in a tree is equal to the depth plus 1. The default is calculated by the following equation, where b is the value of the MAXBRANCH= option in the PROC TREESPLIT statement:

normal upper M normal a normal x normal upper D normal e normal p normal t normal h equals left ceiling StartFraction 10 Over log Subscript 2 Baseline left-parenthesis b right-parenthesis EndFraction right ceiling

This value can be tuned with the AUTOTUNE statement. In the ODS output that corresponds to tables that are generated using the AUTOTUNE statement, the term "MAXLEVEL" is used. The value of MAXLEVEL is equal to the value of the MAXDEPTH= option plus 1.

MINLEAFSIZE=number
LEAFSIZE=number

specifies the minimum number of observations in the training data that each child of a split must contain in order for the split to be considered.

By default, MINLEAFSIZE=5. This value can be tuned with the AUTOTUNE statement.

MINUSEINSEARCH=number

specifies a threshold for using missing values in the split search when ASSIGNMISSING=USEINSEARCH as the missing value policy. If the number of observations that have missing values for the splitting variable is greater than or equal to number, then PROC TREESPLIT uses the USEINSEARCH policy for missing values.

By default, MINUSERINSEARCH=1.

NOMSEARCH(suboption …)

specifies search methods for splitting on a nominal variable. For more information, see the section Splitting Nominal Values.

If you do not specify this option, the default values of the suboptions determine the search method. You can specify one or more of the following suboptions:

MAXCATEGORIES=number

specifies the maximum number of categories to use in a splitting rule. The input is eligible for splitting nodes in which no more than number categories appear. The value of number must be greater than 1.

By default, MAXCATEGORIES=128.

SHRINKAGE=number

specifies how much weight to give the average gradient when you combine it with the average gradient within a category. You use this option only when sorting the categories. The value of number must be nonnegative.

By default, SHRINKAGE=10.

SORT=number

specifies the minimum cardinality in the node of the nominal variable for using the sort method. The sort method sorts the categories and then examines binary splits that preserve the ordering. The value of number must be a nonnegative integer. If number is greater than the value of the MAXCATEGORIES=number option, then the variable is not used in the node.

By default, SORT=10.

NOPRINT

suppresses the generation of ODS output.

NTHREADS=number-of-threads

specifies the number of threads to use in the computation. The default value is the number of CPUs available on the machine.

NUMBIN=number
NBINS=number

specifies the number of bins to use for binning interval predictor variables. PROC TREESPLIT bins continuous predictors to a fixed bin size. This option controls the number of bins and thereby also the size of the bins.

By default, NUMBIN=50. This value can be tuned with the AUTOTUNE statement.

OUTMODEL=libref.data-table

specifies the data table to which to save the decision tree model. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

The data table that results from this option contains information about each node in the decision tree model, including the splitting variables, the child nodes, the number of observations at each node, and the predicted response at each node. This table also has attributes attached that contain information about the input variables, the target variable, and the decision tree model.

PLOTS <(global-plot-option)> <= plot-request <(options)>>
PLOTS <(global-plot-option)> <= (plot-request <(options)> <…plot-request <(options)>>)>

controls the plots that are produced through ODS Graphics. When you specify only one plot-request, you can omit the parentheses around it.

You can specify the following global-plot-option:

ONLY

suppresses the default plots. Only plots that you specifically request are displayed.

You can specify the following plot-requests:

ALL

produces all appropriate plots.

CVCC

produces a plot that is used to determine the tuning parameter for cost-complexity pruning when k-fold cross validation is used. This plot displays the average misclassification rate when the response variable is a classification variable and displays the average square error (ASE) when the response variable is a continuous variable.

NONE

suppresses the default plots. Only plots that you specifically request are displayed.

PRUNEUNTIL

plots the metric that is used to select the final subtree.

This option is enabled by default except when you specify the OFF option in the PRUNE statement (which turns off pruning completely). Specifying the PRUNEUNTIL option has no effect if you also specify the OFF option in the prune statement.

WHOLETREE <(whole-tree-options)>

produces a plot to visualize the entire finished (grown and pruned) tree. This option is enabled by default.

You can specify the following values:

LINKSTYLE=CURVED |ORTHOGONAL |STRAIGHT

specifies the style of links between nodes and leaves in the tree. You can specify the following link-styles:

CURVED

requests curved links between the nodes and their children.

ORTHOGONAL

requests that links go straight down partway from a node to its children, create a horizontal line at the base of the vertical line, and then go straight down from that line to each child.

STRAIGHT

requests that links go straight from the nodes to their children.

By default, LINKSTYLE=CURVED.

LINKWIDTH=CONSTANT |PROPORTIONAL

specifies the width of links between nodes and leaves in the tree. You can specify the following values:

CONSTANT

requests that all links have the same thickness.

PROPORTIONAL

requests that links have a thickness proportional to the total number of observations that go between the node and each child.

By default, LINKWIDTH=PROPORTIONAL.

NOLEGEND

turns off the legend.

ZOOMEDTREE <(zoomed-tree-options)>

produces a plot to visualize a portion of the finished (grown and pruned) tree. This option is enabled by default.

You can specify the following values:

DEPTH=depth

creates a plot down to depth for each node-id specified in the NODES= option.

By default, DEPTH=2.

LINKSTYLE=CURVED |ORTHOGONAL |STRAIGHT

specifies the style of links between nodes and leaves in the tree. You can specify the following values:

CURVED

requests curved links between the nodes and their children.

ORTHOGONAL

requests that links go straight down partway from a node to its children, create a horizontal line at the base of the vertical line, and then go straight down from that line to each child.

STRAIGHT

requests that links go straight from the nodes to their children.

By default, LINKSTYLE=CURVED.

LINKWIDTH=CONSTANT |PROPORTIONAL

specifies the width of links between nodes and leaves in the tree. You can specify the following values:

CONSTANT

requests that all links have the same thickness.

PROPORTIONAL

requests that links have a thickness proportional to the total number of observations that go between the node and each child.

By default, LINKWIDTH=PROPORTIONAL.

NOLEGEND

suppresses the display of the legend

PRINTTARGET

outputs tables that indicate generated columns in the OUT= table from the OUTPUT statement. For a continuous response, PROC TREESPLIT generates an output table named PredName, which indicates the name of the predicted value column. For a categorical response, PROC TREESPLIT generates an output table named PredIntoName, which indicates the name of the predicted value column, and also an output table named PredProbName, which indicates the names of the predicted probability columns.

PRUNINGTABLE

outputs a table of the pruning results.

RBAIMP

creates a variable importance table by using random branch assignment (RBA). This table is created in addition to the normal variable importance table that is calculated using the residual sum of squares (RSS) error. For more information about RBA and RSS variable importance, see the section Variable Importance.

SEED=number

specifies the initial seed for random number generation. The seed is used in the AUTOTUNE statement, in the CROSSVALIDATION statement, and for k-fold cross validation pruning. The value of number must be an integer. By default, the seed is generated by reading the time of day from the computer’s clock.

SPLITONCE

splits predictor variables only once on a branch. When you specify this option, a variable cannot be split more than once on the path from the root to any particular terminal node. However, a variable can be used more than once across branches.

TREEPLOT

creates a table that contains the information used to create the WholeTree and ZoomedTree ODS graphics.

VII=n
INTERACTIONIMP=n

calculates the variable interaction importance, which is described in the section Variable Interaction Importance. n can be one of the following values:

0

suppresses the calculation of variable importance.

1

calculates the importance of individual variables without interactions.

2

calculates the importance of two-way interactions and of individual variables.

3

calculates the importance of three-way and two-way interactions and of individual variables.

If you do not specify this option, then only the importance of individual variables without interactions is calculated.

Last updated: June 22, 2026