Code a Text Variable into a Numeric Variable
Code a Text Variable into a Numeric VariableMinitab®
Procedure
Minitab can be used to translate or "code" a column of text values into another column of numeric values.
- In Minitab select Data >> Recode >> to Numeric...
- In the box labeled Recode values in the following columns, specify the name of the text variable that you want to code.
- Under 'Method', select the option 'Recode individual values'.
- 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.
- 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
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.