Announcement

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

  • How to add categorical control variables to my regression

    Hello!

    I am doing a regression in Stata of my dependent variable and 4 independent variables. They are all measured on a Likert-scale from 1-7. I would like to run a model with my control variables:
    - gender (numerical 1=male 2 = female)
    - country (categorical variable)
    - employees (categorical variable)
    - age (categorical variable - I have 6 age categories)
    - education (categorical - 3 categories)
    - industry ( categorical - 13 categories)

    How should I include them in the model? At the moment the result I get is "no observations". Should I transform my control variables somehow to include them? The regression with just independent variables works and provides results.

    Thank you!



  • #2
    You should check
    Code:
    help factor variables
    to see how estimation commands like regress can work with categorical variables.

    However, for this, the categorical variables need to be numeric and not string. I suspect your categorical variables are the latter, which is why you are getting messages like "no observations". To convert from string to numeric categorical variables, check
    Code:
    help encode

    Comment

    Working...
    X