Announcement

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

  • Plotting a line graph of mean of variables with conditions

    Hi all I am pretty new to stata and Im wondering how I can display a two line grapgh of the same variable but with different conditions over time

    So Ideally, I would have the values of mean on the y axis, and the years on the x axis and then two different color lines displaying the means

    I have variables year, liquidity and treatment. So I would need to display the mean of liquidity over the years if treatment == 0 and he mean of liquidity over the years if treatment == 1

    Could someone help me with this please?

  • #2
    Perhaps

    Code:
    egen mean = mean(liquidity), by(year treatment) 
    
    line mean year if treatment == 1, sort || line mean year if treatment == 0, sort legend(order(1 "treatment" 2 "no treatment"))

    Comment

    Working...
    X