Code a Text Variable into a Numeric Variable

Minitab 18


Procedure Section

Minitab can be used to translate or "code" a column of text values into another column of numeric values.

  1. In Minitab select Data >> Recode >> to Numeric... 
  2. In the box labeled Recode values in the following columns, specify the name of the text variable that you want to code.
  3. Under 'Method', select the option 'Recode individual values'.
  4. For each value of the variable that you want to code, type the text value in the box labeled Recoded value. Make sure you do this for every possible value of the text variable that you want to code.
  5. Select OK. The new numeric variable should appear in your worksheet.  You can rename the column in your worksheet with a more effective label if you want.

Note: if you have more than one text variable to create, you have to code each one separately.

Example Section

The data set birthsmokers2.txt contains data on the birthweight (y = Wgt), gestation length (x1 = Gest) and mother's smoking status (x2 = Smokes, yes or no) of babies born to 32 mothers. If you wanted to fit a multiple regression model that included smoking status, you'd first have to create a numeric variable in your worksheet, dummy say, that equals 1 if Smokes = yes and equals 0 if Smokes = no. Create the dummy variable in your worksheet.

Minitab Dialog Box

dialog box for coding text to numeric

Resulting Minitab Worksheet


Video Review