BART Procedure

PROC BART Statement

  • PROC BART <options>;

The PROC BART statement invokes the procedure. Table 1 summarizes the available options in the PROC BART statement by function. The options are described fully after the table.

Table 1: PROC BART Statement Options

Option Description
Basic Options
ALPHA= Specifies the level for the construction of equal-tail credible intervals
APPLYROWORDER Uses group and order information from the input data table
DATA= Specifies the input data table
LEAFSIGMAK= Specifies the value used to determine the prior variance for the leaf parameter
MAXTRAINTIME= Specifies the maximum time (in seconds) for training
NOCLPRINT Limits or suppresses the display of classification variable levels
NTREE= Specifies the number of trees in the sum-of-trees model
RESTORE= Specifies the input analytic store
SEED= Sets the seed for pseudorandom number generation
MCMC Options
NBI= Specifies the number of burn-in iterations
NDISTCHAINS= Specifies the number of distributed chains to run
NMC= Specifies the number of MCMC iterations, excluding the burn-in iterations
NMCDIST= Specifies the number of MCMC iterations for each chain, excluding the burn-in iterations, when chains are distributed
NTHIN= Specifies the thinning rate
Memory Options
MAPINMEM Stores a mapping of each observation to terminal nodes in memory when the model is trained
TRAININMEM Stores data in memory when the model is trained
Splitting Options
ASSIGNMISSING= Specifies how to handle missing values in predictor variables
BINMETHOD= Specifies the method to use for binning continuous variables
MINLEAFSIZE= Specifies the minimum number of observations per leaf
NBINS= Specifies the number of bins to use for binning continuous variables
ORDERSPLIT= Specifies the minimum cardinality of a categorical input for which to use splitting rules based on level ordering


ALPHA=number

specifies the level for the construction of equal-tail credible limits. The level is 1 – number. The value of number must be between 0 and 1, exclusive. The level applies to the credible limits for all predictive margins. The level also applies to credible limits for predictions in the output data table unless you specify a different level by using the ALPHA= option in the OUTPUT statement.

By default, ALPHA=0.05.

APPLYROWORDER

uses group and order information from the input data table. You can add this information to the input table by using the partition action in the table action set. For more information, see the section The APPLYROWORDER Option in Chapter 2, Shared Concepts. The APPLYROWORDER option is applicable to models that require the simulation of latent variables, and by default it is not enabled. If you specify this option but the table does not contain group and order information, the procedure terminates with an error.

ASSIGNMISSING=MACBIG | MACSMALL | NONE | SEPARATE

specifies how to handle missing values during the training and scoring phases.

During the training phase, PROC BART samples a primary splitting rule for a node as described in the section Splitting Rules. During the scoring phase, observations are assigned to a node in a tree according to the primary splitting rule if it can be applied. If the primary rule cannot be applied because of missing values or unknown categorical predictor levels, a default splitting rule is applied that assigns an observation to the larger branch of the split. An unknown level of a categorical predictor is a level that was not encountered in the training data but is encountered during scoring. The default splitting rule enables all data to be scored.

You can specify one of the following values:

MACBIG

during the training phase, treats missing values for continuous predictors as the largest machine value and treats missing values for categorical predictors as a separate level. In the scoring phase, observations that have missing continuous predictor values are assigned to the right branch of the split, and observations that have an unknown categorical predictor level are assigned to the larger branch of the split.

MACSMALL

during the training phase, treats missing values for continuous predictors as the smallest machine value and treats missing values for categorical predictors as a separate level. In the scoring phase, observations that have missing continuous predictor values are assigned to the left branch of the split, and observations that have an unknown categorical predictor level are assigned to the larger branch of the split.

NONE

during the training phase, excludes all observations that have a missing predictor value. In the scoring phase, observations that have missing values or observations whose unknown categorical predictor level is unknown are assigned to the larger branch of the split.

SEPARATE

during the training phase, treats missing values for continuous predictors as a separate group and treats missing values for categorical predictors as a separate level. In the training phase, when a split operation is sampled for a continuous predictor and there are observations that have a missing value of the splitting variable on the node, a primary rule for routing missing values is sampled before the primary splitting rule for nonmissing values is sampled. If a continuous predictor does not have a missing value on the node that you are splitting, a primary rule for routing missing values is not sampled. In the scoring phase, observations that have an unknown categorical predictor level or have a missing continuous predictor value for a node without a primary rule for routing missing values are assigned to the larger branch of the split.

By default, ASSIGNMISSING=SEPARATE.

BINMETHOD=EVEN | QUANTILE

specifies how to bin continuous input variables before training the model. The number of bins that are created is determined by the value of the NBINS= option.

You can specify one of the following values:

EVEN

discretizes continuous 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 the result by the number of bins.

QUANTILE

discretizes continuous 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 the various bins is approximately equal.

By default, BINMETHOD=QUANTILE.

DATA=libref.data-table

names the input data table for PROC BART to use. The default is the most recently created data table. 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.

LEAFSIGMAK=number

specifies the number to be used to determine the prior variance for the leaf parameters. For more information about the tree prior, see the section Tree Prior.

By default, LEAFSIGMAK=2.

MAPINMEM
OBSLEAFMAPINMEM

stores a mapping of each observation to terminal nodes, or leaves, in memory when the model is trained. Storing the observation-to-leaf map in memory eliminates the need to route observations through trees when tree-modifying operations are sampled, and it can improve performance. However, the observation-to-leaf map requires memory allocations that are, in total, proportional to the number of observations times the value of the NTREE= option.

By default, the observation-to-leaf map is not stored in memory.

MAXTRAINTIME=number

specifies the maximum time (in seconds) to use for model training.

By default, there is no time limit.

MINLEAFSIZE=number

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

By default, MINLEAFSIZE=5.

NBI=number

specifies the number of burn-in iterations to perform before the procedure starts to save samples for prediction.

By default, NBI=100.

NBINS=number

specifies the number of bins to use for binning the continuous input variables.

By default, NBINS=50.

NDISTCHAINS=number

specifies a distributed mode that divides the MCMC sampling in a grid environment. This mode distributes training data to workers so that the specified number of workers have a full copy of the training data and run a separate chain. Using this option can reduce the cost of communication over the grid and allows multiple chains to be run in parallel. However, distributed mode requires more memory space for each worker. This option is not applicable when you are in single-machine mode. When NDISTCHAINS=0, a single chain is run, and each worker node is assigned a portion of the training data. Note that the fit of a BART model depends on the number of chains that you run.

By default, the number of chains is equal to the number of worker nodes.

NMC=number

specifies the number of iterations in the main simulation loop. This is the MCMC sample size if NTHIN=1. This option is ignored if you specify the NMCDIST= option.

By default, NMC=1000.

NMCDIST=number

specifies the number of MCMC iterations for each chain, excluding the burn-in iterations, when multiple chains are used. This option is not applicable when you are in single-machine mode or when NDISTCHAINS=0.

By default, the number of MCMC iterations is evenly distributed across chains, and the total number is equal to the value of the NMC= option.

NOCLPRINT<=number>

suppresses the display of the "Class Level Information" table if you do not specify number. If you specify number, the values of the classification variables are displayed for only those variables whose number of levels is less than number. Specifying a number helps reduce the size of the "Class Level Information" table if some classification variables have a large number of levels.

NTHIN=number

specifies the thinning rate of the simulation. PROC BART keeps every numberth simulation sample and discards the rest. All the posterior statistics are calculated using the thinned samples.

By default, NTHIN=1.

NTREE=number

specifies the number of trees in a sample of the sum-of-trees ensemble.

By default, NTREE=200.

ORDERSPLIT=number

specifies the minimum number of levels for which a categorical input uses splitting rules according to level ordering. For more information about the sampling of splitting rules, see the section Splitting Rules.

By default, ORDERSPLIT=50.

RESTORE=libref.data-table

specifies the name of the analytic store that contains a model that is fitted and stored from a previous analysis. The analytic store is created by a STORE statement from a previous PROC BART call or by a store parameter that is specified in a previous bartGauss or bartProbit action call.

You can use the previously fitted model to either score data or compute predictive margins. For each task, you use the DATA= option to specify the input data table to be used. To score the input data, you specify the OUTPUT statement to create a data table that contains the observationwise predictions and statistics. To compute predictive margins relative to the covariate distribution in the input data, you specify one or more MARGIN statements. When you compute predictive margins, you can also use the MARGINDIFF statement to specify a contrast between predictive margins that is defined by different MARGIN statements. You can use the OUTPUTMARGINS statement to create an output data table that contains the predicted marginal mean for each saved sample of the ensemble.

Because the previously fitted model is stored, you cannot use statements and options specific to training a model. In particular, the CLASS, FREQ, GAUSSPRIOR, MODEL, PARTITION, STORE, and TREEPRIOR statements are not available when you specify the RESTORE= option. When you use this option, you cannot specify both the OUTPUT statement and the MARGIN statement. You must use separate PROC BART calls to score data and compute predictive margins when you use a previously fitted model.

For more information about using a previously fitted model to score new data or compute predictive margins, see Example 4.1: Storing and Scoring.

SEED=number

specifies the initial seed for random number generation for model building. The value of number must be an integer. If you do not specify a seed or you specify a number less than or equal to 0, the seed is generated by reading the time of day from the computer’s clock.

TRAININMEM

stores data in memory when the model is trained. Storing the data in memory can improve performance, but it requires memory allocations that are, in total, proportional to the number of observations times the size of a row of predictors.

By default, the data are not stored in memory.

Last updated: June 22, 2026