## Problem

You want to create a new data table column that contains values that are based on the evaluation of a formula. The formula uses the value of another column to determine the value in the new column.

## Solution

This solution uses the Big Class sample data table and creates a formula that uses the value of the Age column to determine a resulting category for a new column called Adolescent Phase. If the value of Age is less than or equal to 12, the formula returns "early"; if the value of Age is greater than 12 but less than or equal to 15, the formula returns "mid"; if the value of Age is greater than 15, the formula returns "late".

```
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "Adolescent Phase",
Character,
Formula(
If(
:age <= 12, "early",
12 < :age <= 15, "mid",
"late"
)
)
);
```

## Discussion

A formula column can use the values from other columns in the data table, but it does not have to use them. In fact, you can use random number generation JSL functions in formula columns to create random numbers in a data table. Creating formula columns like this is also sometimes known as *feature creation*.

## See Also

Documentation