Announcement

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

  • Modifying a variable

    Hello,

    I have an education variable called educ and the variable has 5 items: 1-less than high school, 2-high school, 3-some college, 4-college, 5- advanced degree. However, i want only three items in this variable. i would like to combine 1 & 2 and drop 5. So i would have 1- high school or less, 2-some college, 3- college. How can i do this, without creating/generating three new variables?

  • #2
    I don't understand what you mean when you say you want to "drop 5." Do you mean you want to remove those people from the data set entirely? Is there a good reason to do that? Or do you mean that you want to combine 5 with 4 since (nearly) everybody with an advanced degree also has been through college? If the latter, you can do this:

    Code:
    recode educ (1/2 = 1) (3 = 2) (4/5 = 3), gen(new_educ)
    label define new_educ 1 "HS or less" 2 "Some College" 3 "College"
    label values new_educ new_educ
    
    //  VERIFY IT IS CORRECT
    tab educ new_educ

    Comment


    • #3
      Thanks for the answer, Clyde! I want to remove those people entirely.I want to look at the wages of individuals with less a college degree or less. I'm not interested in individuals with an advanced degree. The people with an advanced degree would also be counted in the college category (if they finished college).

      Comment


      • #4
        So then it's just a bit different:

        Code:
        drop if educ == 5
        recode educ (1/2 = 1) (3 = 2) (4 = 3), gen(new_educ)
        label define new_educ 1 "HS or less" 2 "Some College" 3 "College"
        label values new_educ new_educ
        
        // VERIFY IT IS CORRECT
        tab educ new_educ

        Comment

        Working...
        X