Announcement

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

  • Categorical Variables Stata 9

    Hi. I have Stata 9, and I'm trying to run a simple regression with both continuous and categorical variables. When I use the i.variable for my categorical variable, I get an error "operator invalid"

    regress herbgrass i.aspect_cat i.cwd_class slope elevation block_id
    i: operator invalid


    My variables have 3 classes and are numerically coded (1,2,3).
    Is the "i." command not available in Stata9? Any suggestions for getting Stata9 to recognize a categorical variable in a linear regression?

    Thanks in advance.
    Alicia

  • #2
    Look up xi:. Do something like

    xi: regress herbgrass i.aspect_cat i.cwd_class slope elevation block_id

    You might also just compute the dummies yourself, via something like

    tab aspect_cat, gen(aspectc)

    I hate xi:, but it may be your easiest option with such an old version of Stata.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Thanks so much Richard!

      Comment

      Working...
      X