Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Industry Dummy Variables

    I am conducting a cross-sectional study on UK firms and I've created an industry variable 'ind1' that contains value labels for each industry category. I now want to create dummy variables for each study and attempted to do with the following code.
    tabulate ind1, generate(ind) However, Stata returns r(110) indicating that my variable is defined but I do not intend on redefining the variable. I still have another variable 'industry' from which I derived my ind1 variable. How do I create my set of dummy variables then?

  • #2
    The error message you received, which would have been "variable ind1 already defined" occurred because the -tabulate- command attempted and *failed* to create indicator (dummy) variables) for the stub you specified, which was "ind." Your stub would result in variables named ind1, ind2, ind3, ..., ind11. Stata cannot proceed because the variable "ind1" already exists. If you would choose a different stub, you would not have this problem. Try this:
    Code:
    tabulate ind1, generate(ind_dum)
    All this being said: Stata has a facility for creating indicator variables automatically "on the fly," which most people prefer. So, while learning to create the indicator variables is likely a good experience for you, especially if you are not experienced using indicator variables, there are easier ways to do this. The facility for creating indicator variables automatically is known in Stata as "factor variable notation," which you can learn about at -help fvvarlist-.

    An example of using factor variable notation in your context would be:
    Code:
    regress y i.ind1
    which would create the entire list of indicator variables (invisibly and temporarily in the background), run the regression omitting the variable for the lowest numbered category of ind1, and produce the results with coefficients for each level of ind1. Try this command and see if you like it.

    Comment

    Working...
    X