Announcement

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

  • Create new variable based on other variables

    I have a data set on gross income and I'm trying to display the percent of total gross income (in a pie chart) that comes from 1. wage income 2. interest/dividend income and then 3. other income (Business and farm income, ss income, etc.).

    How do I create a new variable that is the sum of all of the 'other' variables. Basically, I want a pie Chart that Shows percent of total gross income that Comes from
    1. wages
    2. interest and dividend
    3. other

    Thanks!

  • #2

    Code:
    gen total = wages + interest_and_dividend + other
    But you don't need an explicit total variable. Try this:

    Code:
    clear
    set obs 1
    gen a = 1
    gen b = 2
    gen c = 3
    graph pie a b c

    Comment

    Working...
    X