Consider the following problem
This graph thename has a default setting for the notes ("Reference line is Proposition 99") that is overidden by the gr1opts user specification (A note). But instead when I try
I get
Res:
We know that the option is allowed, but what Stata really means here is that I can't override the "default" settings. Is there a way for me to allow the users to override the default specifications in this case, or must I force the users to specify a name for the graph they want to create?
Code:
clear input float(year cigsale3) double cf float(relative diff_) 1970 123 121.92725691872532 -19 1.072743 1971 121 121.66004415484993 -18 -.6600441 1972 123.5 123.75698252957822 -17 -.25698254 1973 124.4 124.0789372650865 -16 .3210643 1974 126.7 126.65069118644594 -15 .04930576 1975 127.1 126.55805829701353 -14 .54194015 1976 128 127.90038020440369 -13 .0996198 1977 126.4 126.35920527782213 -12 .04079625 1978 126.1 125.32134014510042 -11 .7786583 1979 121.9 122.3484005974409 -10 -.4483991 1980 120.2 120.0459969754882 -9 .15399997 1981 118.6 119.11099732095471 -8 -.51099885 1982 115.4 115.7825688524409 -7 -.3825673 1983 110.8 111.09636809687582 -6 -.29636505 1984 104.8 104.46010652788014 -5 .3398965 1985 102.8 102.79657286742768 -4 .0034301844 1986 99.7 99.36232031049343 -3 .3376766 1987 97.5 97.43801796722012 -2 .06198203 1988 90.1 91.34575450475235 -1 -1.245756 1989 82.4 88.8787224048994 0 -6.478721 1990 77.8 85.00379528608904 1 -7.203792 1991 68.7 80.4232863656793 2 -11.72329 1992 67.5 78.8046578883549 3 -11.304658 1993 63.4 78.84614359370377 4 -15.446142 1994 58.6 76.36207861541085 5 -17.76208 1995 56.4 74.35144285498316 6 -17.95144 1996 54.5 73.43396162035721 7 -18.933962 1997 53.8 73.41434466576078 8 -19.614346 1998 52.3 71.64206353974298 9 -19.342064 1999 47.2 70.66587172288293 10 -23.46587 2000 41.6 65.4188627536998 11 -23.818865 end format %ty year cls tsset year loc depvar cigsale3 local y_lab: var lab `depvar' labvars cigsale3 year cf "Real California" "Year" "Synthetic California" su diff if year >= 1989 loc ATT: di %6.3g r(mean) loc obsopts lcolor(black) lwidth(thick) loc cfopts lcolor(red) lwidth(medium) lpat(solid) loc gr1opts caption("ATT = `ATT'") scheme(sj) /// yti("Cigarette Sales") xsize(4) ysize(4) legend(cols(1)) /// tline(1989, lcol(black) lpat(solid)) legend(pos(7) ring(0)) note(A note) /// name(thename, replace) twoway (tsline cigsale3, `obsopts') /// (tsline cf, `cfopts'), /// note("Reference line is Proposition 99") /// `gr1opts'
Code:
twoway (tsline cigsale3, `obsopts') /// (tsline cf, `cfopts'), /// note("Reference line is Proposition 99") /// name(anothername, replace) `gr1opts'
Code:
clear * input float(year cigsale3) double cf float(relative diff_) 1970 123 121.92725691872532 -19 1.072743 1971 121 121.66004415484993 -18 -.6600441 1972 123.5 123.75698252957822 -17 -.25698254 1973 124.4 124.0789372650865 -16 .3210643 1974 126.7 126.65069118644594 -15 .04930576 1975 127.1 126.55805829701353 -14 .54194015 1976 128 127.90038020440369 -13 .0996198 1977 126.4 126.35920527782213 -12 .04079625 1978 126.1 125.32134014510042 -11 .7786583 1979 121.9 122.3484005974409 -10 -.4483991 1980 120.2 120.0459969754882 -9 .15399997 1981 118.6 119.11099732095471 -8 -.51099885 1982 115.4 115.7825688524409 -7 -.3825673 1983 110.8 111.09636809687582 -6 -.29636505 1984 104.8 104.46010652788014 -5 .3398965 1985 102.8 102.79657286742768 -4 .0034301844 1986 99.7 99.36232031049343 -3 .3376766 1987 97.5 97.43801796722012 -2 .06198203 1988 90.1 91.34575450475235 -1 -1.245756 1989 82.4 88.8787224048994 0 -6.478721 1990 77.8 85.00379528608904 1 -7.203792 1991 68.7 80.4232863656793 2 -11.72329 1992 67.5 78.8046578883549 3 -11.304658 1993 63.4 78.84614359370377 4 -15.446142 1994 58.6 76.36207861541085 5 -17.76208 1995 56.4 74.35144285498316 6 -17.95144 1996 54.5 73.43396162035721 7 -18.933962 1997 53.8 73.41434466576078 8 -19.614346 1998 52.3 71.64206353974298 9 -19.342064 1999 47.2 70.66587172288293 10 -23.46587 2000 41.6 65.4188627536998 11 -23.818865 end format %ty year cls tsset year loc depvar cigsale3 local y_lab: var lab `depvar' labvars cigsale3 year cf "Real California" "Year" "Synthetic California" su diff if year >= 1989 loc ATT: di %6.3g r(mean) loc obsopts lcolor(black) lwidth(thick) loc cfopts lcolor(red) lwidth(medium) lpat(solid) loc gr1opts caption("ATT = `ATT'") scheme(sj) /// yti("Cigarette Sales") xsize(4) ysize(4) legend(cols(1)) /// tline(1989, lcol(black) lpat(solid)) legend(pos(7) ring(0)) note(A note) /// name(thename, replace) twoway (tsline cigsale3, `obsopts') /// (tsline cf, `cfopts'), /// note("Reference line is Proposition 99") /// name(anothername, replace) `gr1opts'
Code:
. twoway (tsline cigsale3, `obsopts') /// > (tsline cf, `cfopts'), /// > note("Reference line is Proposition 99") /// > name(anothername, replace) `gr1opts' option name() not allowed