Announcement

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

  • How to create multiple line graph among two groups

    How can I create two multiple line graphs among two groups (for example figure A among male and figure B among female) and combine figure A and B using grc1leg command?

  • #2
    grc1leg (from http://www.stata.com/users/vwiggins, as you are asked to explain: FAQ Advice #12) is only needed in extreme cases. Your question should yield to something like by(female) -- I can't be sure of your variable names, as you give none (FAQ Advice #12 again).

    Here is a not completely silly example with line graphs side by side for two groups. In this case I made up the groups, but your grouping variable should be something you have already.

    You can run this code in your Stata to see for yourself.

    Code:
    webuse grunfeld, clear
    gen group = mod(company, 2)
    tab company group
    
    line invest year, by(group, note("")) c(L) ysc(log) scheme(s1color) yla(1 10 100 1000)
    Make sure that you have value labels defined for male and female so that they show up in your graph.

    If this does not make sense then please work from https://www.statalist.org/forums/help#stata and give us a data example.

    See also https://www.stata-journal.com/articl...article=gr0080

    Comment

    Working...
    X