Chief Technology Officer at Data Testing Firm
Computer Engineering (Added by Blessing) at University of Melbourne
A dummy variable is a variable that takes on the values 1 and 0; 1 means something is true (such as age < 25, sex is male, or in the category “very much”).
Dummy variables are also called indicator variables.
As we will see shortly, in most cases, if you use factor-variable notation, you do not need to create dummy variables.
In cases where factor variables are not the answer, you may use generate to create one dummy variable at a time and tabulate to create a set of dummies at once.
I have a discrete variable, size, that takes on discrete values from 0 to 4
. tabulate size size | Freq. Percent Cum. ------------+----------------------------------- miniature | 19 19.00 19.00 small | 37 37.00 56.00 normal | 30 30.00 86.00 large | 12 12.00 98.00 huge | 2 2.00 100.00 ------------+----------------------------------- Total | 100 100.00
If I want a dummy for all levels of size except for a comparison group or base level, I do not need to create 4 dummies. Using [U] factor variables, I may type
. summarize i.size
or use an estimator