The Manage Enums Tab

The Enum type is a data type for categorical data with a predefined set of valid values.

You make an Enum column by creating an Enum definition and converting a string or int64 column to the Enum type in The Convert Column Types Tab. For the Categorical columns and factor columns of a synthetic dataset created in the Synthetic Data Generator tab, MIDAS assigns Enum definitions when the dataset is saved.

An Enum definition can be referenced from multiple datasets in the same project, but not from other projects.

Opening the Manage Enums Tab

Select Data > Manage Enums... from the menu bar to open the Manage Enums tab.

Manage Enums tab

Creating an Enum Manually

New Enum

  1. Click + New Enum
  2. Enter the Enum name
  3. Enter the values. The order you enter them is recorded as the Enum's value order. Categories of Enum columns follow this order on graph axes and in sorting, regardless of the measurement scale
  4. Click + Add Value to add more values
  5. Click Save

Validation Rules

  • Leading and trailing whitespace is automatically trimmed. Values are case-sensitive, so High and high are treated as distinct values

Creating an Enum from a Column

You can auto-generate an Enum definition from the unique values of an existing string column.

  1. Click Create from Column
  2. Select a dataset
  3. Select a column. Only string-type columns are available
  4. Enter the Enum name. The default is {column_name}_enum
  5. Review the preview showing unique values with their counts and percentages
  6. Click Create Enum

Values are sorted by frequency in descending order.

After creation, check the value order by editing the Enum. Categories of Enum columns follow this order regardless of the measurement scale, so if you keep the descending frequency order, graph axes and sorting also follow descending frequency. To reflect the order in statistics, convert the column to the Enum type and then change it to the ordinal scale.

Create Enum from Column dialog

Editing and Deleting Enums

Editing

Click Edit on an Enum card to enter edit mode. You can change the name, add or remove values, and change the value order. To reorder values, use the up and down arrow buttons next to each value.

When columns have already been converted to this Enum type, the following restrictions apply:

  • The name cannot be changed. To rename, first convert the dependent columns back to string, then change the Enum name, and convert the columns to Enum again. The columns of a synthetic dataset cannot be converted back to string, so an Enum definition referenced by a column of a synthetic dataset cannot be renamed

When you save a new value order, it is immediately reflected in The Statistics Tab, Data Table sorting, and graph legend ordering for the converted columns. For an ordinal column, order comparisons in filter expressions also compare values in the new order. On graph axes, nominal columns follow the new order, but ordinal columns in existing graphs are not reordered automatically. When an ordinal column is assigned to an axis, the graph keeps the value order at that time as its Category Order. To apply the new order to the axis, change the Category Order in the graph settings panel.

When you save a change to the values or their order, MIDAS recomputes the Derived Datasets that have a column of this Enum type, and the Derived Datasets and models that depend on a dataset with a column of this Enum type. For the scope of the recomputation, see Recomputation When a Dataset Changes.

Deleting

Click Delete on an Enum card to delete the Enum definition.

Ordinal Scale and Graph Ordering

Changing to Ordinal Scale

Enum columns default to the nominal scale. If the value order is meaningful, right-click the column header in Data Table and select Edit Scale of Measurement to change it to the ordinal scale. The measurement scale determines which statistics are shown in The Statistics Tab. An ordinal column compares its values in the order of the Enum definition in order comparisons such as >, <, and BETWEEN in filter expressions. For more on measurement scales in general, see Data Types and Measurement Scales.

Graph Axis Ordering

Categories of Enum columns follow the Enum definition order on graph axes, in legends for aesthetics (color, fill, shape, etc.), and across facet panels, regardless of the measurement scale. The same order is used for Data Table sorting, Crosstab headers, the order in which the Dummy Coding tab generates dummy variables, and the order of the columns that Long to Wide in the Reshape tab creates. When an ordinal column is assigned to an axis, the Enum definition order is set as the initial Category Order. For an ordinal column, the legend lists all values in the Enum definition, including values that do not occur in the data. For a nominal column, the legend lists only the values that occur in the data. You can manually change the axis display order from the Category Order section in the graph settings panel.

The basic statistics table of statistics by measurement scale assumes numeric columns (int64, float64). For Enum columns on the nominal scale, only frequency counts are shown, the same as string columns. On the ordinal scale, min / max / median / quartiles are also computed from the position order of the Enum definition, in addition to the frequency counts. mean / std / skewness / ex. kurt are not computed because ordinal categories do not have a defined distance. IQR (= Q3 − Q1) is also not meaningful on an ordinal scale because distances between values are not defined, and is therefore not computed. See Basic Statistics - String Type and Enum Type for how these are computed.

See also