Announcement

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

  • Generating new variables using an if function

    I am trying to sort income based on marital Status and then generate new adjusted income based on tax brackets. There is one variable "income" and then another variable "married". The income variable just has the total income. The "married" variable has either the value 1 (which corresponds to being married) or 2 (which is a single filer).

    How do I generate two new variables based on marital Status? So a married income and a single income?

    I have tried using this, but it doesn't work.

    gen incsing = income if married = 2

    Please help!

  • #2
    The logical operator "is equal to" is in Stata == not = (see help operator), so your command should have been: gen incsing = income if married == 2
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment

    Working...
    X