Minitab Cookbook
上QQ阅读APP看书,第一时间看更新

Coding a numeric column to text values

In the pulse worksheet, the Activity column lists the usual level of activity of the students in the study, where 1 denotes slight activity, 2 is moderate activity, and 3 stands for a lot of activity.

We will change the numeric values of Activity from 1, 2, and 3 into Slight, Moderate, and High.

Getting ready

Use File and Open Worksheet to open the pulse.mtw dataset worksheet from the sample Minitab data folder.

How to do it…

The following instructions will convert the values of 1, 2, and 3 in the Activity column to Slight, Moderate, and High:

  1. In the Data menu, navigate to Code | Numeric to Text.
  2. Enter the Activity column into Code data from columns.
  3. Enter the Activity column into the section Store coded data in columns.
  4. In the Original values section, enter 1 in the first line, 2 in the second line, and 3 in the third line, as shown in the following screenshot:
  5. In the New section, enter Slight in the first line, Moderate in the second line, and High in the third line.
    How to do it…
  6. Click on OK.

How it works…

The code tools work like an IF statement. The code tools cannot be set as an updating formula in the worksheet like the IF statements can be set from the calculator.

In this example, we are replacing the numeric values in the Activity column and putting the new results back into the same column. This will change the data type of the Activity column from Numeric to Text.

There's more…

Ranges of numbers can be entered using colons. If we wish to change the values from 0 to 30 as low, 30 to 60 as medium, and 60 and above as high, then we would enter these as shown in the following screenshot:

There's more…

The code tool does not accept symbols such as >, <, or =, and therefore, we can use a large number, such as 100000, to create a greater than statement.

See also

  • The Calculator – using an if statement recipe