Some algorithms, for example, regression analysis algorithms, need numerical input variables. If you want to use a categorical variable in the analysis, you need to convert it somehow to a numerical one. If the variable is ordinal, this is not a problem; you just assign appropriate integers to the naturally ordered values of the variable. From a nominal variable, you can create a set of indicators. There is one indicator for each possible value, showing whether the value it represents is taken for a case. If a specific value is taken for a case, you assign 1 to the indicator for this value value, or otherwise 0. Such new variables, the indicators, are also called dummy variables, or dummies. In T-SQL, you can use the IIF() function to generate dummies, as the following code shows:
SELECT TOP 3 MaritalStatus,
IIF(MaritalStatus = 'S', 1, 0)
AS [TM_S...