Announcement

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

  • Producing multiple graphs in one output

    Hello,

    I want to create multiple graphs diagrams in a single output. As far as I know I need to do this with the foreach command. I want to show wages for each women and men for each country over the years. So the line graphs for the sexes in one graph and for each country an individual graph.

  • #2
    Code:
    line wages year if male == 1 || line wages year if male == 0, by(country)
    is a pattern.

    But the details can be delicate. How many countries? Alphabetical order will usually not be best. Tell us more about your data to get a better answer.

    Comment


    • #3
      No loop necessary. Say your wage variable is called wage, your gender variable is called female (0 male, 1 female), your country variable is called country, and your year variable is called year, then you can type in Stata:

      Code:
      separate wage, by(female) veryshortlabel
      twoway line wage0 wage1 year, by(country, compact note(""))
      If female was coded as 1 male, 2 female, then the two new variables created by separate would be wage1 and wage2 and you would need to adjust the twoway command accordingly.
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment


      • #4
        #2 and #3 are essentially the same idea

        Comment


        • #5
          Ok thanks. It worked!

          Comment

          Working...
          X