Announcement

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

  • shading zone in graph

    Dear All, According to the following data
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(misery year)
     5.091475 1982
     4.086741 1983
     2.418046 1984
     2.750179 1985
    3.3483305 1986
     2.494642 1987
    2.9710374 1988
     5.989113 1989
     5.797411 1990
      5.12913 1991
     5.972925 1992
    4.3954687 1993
     5.658466 1994
     5.454727 1995
     5.681333 1996
     3.623719 1997
     4.377909 1998
     3.089377 1999
     4.241268 2000
         4.57 2001
     4.969599 2002
     4.711107 2003
     6.050919 2004
     6.431002 2005
     4.512669 2006
     5.707176 2007
     7.660387 2008
     4.987144 2009
     6.172523 2010
     5.809878 2011
         6.17 2012
     4.974663 2013
     5.157197 2014
     3.472219 2015
     5.318939 2016
    end
    I'd like to have a graph with shading zone between 2000-2008 but find something wrong in the code:
    Code:
    gen upper = 7.66
    local barcall "upper year if inrange(year, 2000, 2008), bcolor(gs14) base(10)"
    local tslinecall "misery, xline(1984, lp(dash_dot) lc(green)) xline(2008, lp(dash) lc(red)) legend(off)"
    
    twoway bar `barcall“ || tsline `tslinecall'
    The error message is
    Code:
    too few quotes
    r(132);
    Any suggestions? Thanks.
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

  • #2
    I guess you got your quotes wrong in `barcall' (you wrote `barcall“)
    Roman

    Comment


    • #3
      Originally posted by Roman Mostazir View Post
      I guess you got your quotes wrong in `barcall' (you wrote `barcall“)
      Dear Roman, My bad, you are right. Thanks.
      Ho-Chuan (River) Huang
      Stata 19.0, MP(4)

      Comment

      Working...
      X