"ERROR: Maximum levels of 512 exceeded ... Training will not be performed ..." messages appear


By default, SAS® Enterprise Miner™ limits the maximum number of levels of a nominal variable to 512. If you exceed this limit, messages similar to the following are displayed:

ERROR: Maximum levels of 512 exceeded. ERROR: Maximum target levels of 512 exceeded. Training will not be performed. ERROR: Number of class levels for <variable name> exceeds limit. NOTE: The class levels limit is set by the macro variable EM_TRAIN_MAXLEVELS: 512
 

This error does not necessarily mean that there is a problem. "Target levels" in the error text refers to the targeted number of levels (512), not to your literal target variable.

The most common reason that this error occurs is the variable definition or measurement level. Possibly a variable in the data source is defined as a Nominal Input, when instead the variable should be defined as an Interval Input, or as an ID. A second common reason is that you do want to define the variable as a Nominal Input, but that the variable has more than 512 levels. In that case, increase the limit on the number of levels. If you encounter this error and do not suspect a problem with your data, then you can eliminate this message in two ways. To decide whether to change the definition or to increase the number of levels, use your knowledge about your data to determine the statistically appropriate method for the analysis.

After you make either change, you need to either force the flow to re-run, or to delete your existing problem node and replace the problem node with a new node. To force the flow to re-run, change the Rerun property in the first node of your flow to Yes and then re-run the flow.

In SAS® Enterprise Miner™ 12.3 and later, you can override the EM_TRAIN_MAXLEVELS setting in either of two methods. You can use the Project Start Code or you can use the Project Macro Variables. Prior to 12.3, only the Project Start Code method was available. To access these properties, click the project name in the Project Panel (upper left area). The Project Start Code property and the Project Macro Variables property are displayed in the Properties panel (middle left are). For information, see the chapter "SAS Enterprise Miner User Interface Help". To access the chapter in SAS Enterprise Miner, select Help ► Contents ► User Interface ► SAS Enterprise Miner User Interface Help.

Enterprise Miner window with a Project Macro Variables pop-up open. EM_TRAIN-MAXLEVELS is selected with the default value of 512.

%let EM_TRAIN_MAXLEVELS = MYVALUE;

 

When SAS Enterprise Miner runs, Project Macro Variables are processed before Project Start Code. Therefore, if you specify EM_TRAIN_MAXLEVELS values in both locations, only the value that is specified in Project Start Code is used.