Announcement

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

  • Graphing - tline by dummy

    Hi all,

    I want to add shaded bars to my graph using tline. I notice that the stata help file only indicates how to add bars by explicit dates input. I have too many to input manually and wish to add them by a variable which is a dummy corresponding to a date.

    Thanks

    Code:
    twoway (line SPFrespondentsexpect1519 TIME, ylabel(0(20)60)) (line CCI_EA19 TIME, yaxis(2)), ylabel(90(10)105, axis(2)), tsline SPFrespondentsexpect1519 CCI_EA19, tline(dummy_I_wish_to_add)
    dataex

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(CCI_EA19 SPFrespondentsexpect1519) int TIME byte recession
    101.2044   10 14304 0
    100.9661 13.5 14396 0
    101.2185 15.6 14488 0
    101.5935  7.7 14579 0
    101.9143 59.5 14670 0
    102.1269 55.1 14762 0
    101.8142 30.7 14854 0
    101.8627  5.9 14945 0
    101.7925 34.5 15035 1
    101.2683 16.3 15127 1
    100.3191  2.1 15221 1
     100.043  3.4 15312 1

  • #2
    Shaded bars seemed ambiguous but the magic word "recession" allows a guess at what you mean. (Cox's Third Law of Statalist is that to a good first approximation we don't work in your field so you may need to explain as if we are ignorant.)

    https://www.stata-journal.com/articl...article=gr0067 is a review of this territory.

    Comment

    Working...
    X