|
|
|
||||
|
|
|||||
The simplest way of creating dummy variables for a categorical variable is through Command interface from Data Manipulation menu. Let's say we have a variable called time taking values 0 to 3 and we need to make a full set of 4 dummy variables for it. Let's also assume that column 10 to 13 are not used by any variables. We can then issue the following command in the Command interface.
dumm "time" c10-c13
From the Output window, we see the following message.
->dumm "time" c10-c13 full set of 4 dummies created
The other way to create dummy variables is through Main effects and interactions from Model menu. The first thing we have to do is to declare that variable time is a categorical variable. This is done through Names from Data Manipulation menu. After we click on the Names, highlight variable time and click on Categories. This will bring up a window like the following and we click on Apply to set it to be categorical.

Once the variable time is set to be categorical, we can then use Main effects and interactions menu. From Main effects and interactions window, select variable time from the Categorical field.

Then click on Main Effects. Now click on the fields to be included as shown below. The last step is to click on Build.

We can see that four dummy variables have been created if we click on Names from Data Manipulation menu again. The following shows that time_1 to time_4 have been created.

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services