Announcement

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

  • Combining Variables

    I do not know how to combine variables within a variable. I have the following data and I wish to combine Tribal, Others, and None into 1 variable so that the 3 of them are "7". Any suggestions on how to do this?

    type: numeric (int)
    label: ID14

    range: [1,9] units: 1
    unique values: 9 missing .: 0/41554

    tabulation: Freq. Numeric Label
    33527 1 Hindu
    4788 2 Muslim
    1376 3 Christian
    990 4 Sikh
    281 5 Buddhist
    138 6 Jain
    427 7 Tribal
    24 8 Others
    3 9 None

  • #2
    If var is your variable, use
    Code:
    recode var (7 8 9 = 7), gen(newvar)
    to generate a recoded version newvar of var.
    You will also need to define a new value label for your recoded variable. See help recode.

    Last edited by Jorge Eduardo Perez Perez; 01 Apr 2014, 18:09.
    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X