Announcement

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

  • Converting categorical variables into binary variables

    As a part of testing different approaches for my research, I would like to convert categorical variables into binary responses before applying to probabilistic models. For example, one variable has six categories, this should be converted to six variables each with binary responses. Which command of Stata can do this? In my dataset, I have different variables with different categorical scale. Some with 1-6 scale, some with 1-3 scale etc. Is there any way using Stata to convert all these variables to binary variables in one command for all? Thanks for any help.

  • #2
    try -tabulate- with the gen() option

    Comment


    • #3
      The easiest solution is to use the factor variable notation, so instead of typing reg y x1 x2 you can type reg y i.x1 i.x2. This will work for most estimation commands, not just regress. You can learn more by typing in Stata help fvvarlist.
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment

      Working...
      X