Code:
use "synth_smoking", clear
xtset state year
** loop through units
forval i=1/39 {
quietly synth cigsale retprice cigsale(1988) cigsale(1980) cigsale(1975), ///
xperiod(1980(1)1988) trunit(`i') trperiod(1989) keep("synth_`i'", replace)
}
forval i=1/39 {
use synth_`i', clear
rename _time year
gen tr_effect_`i' = _Y_treated - _Y_synthetic
keep year tr_effect_`i'
drop if missing(year)
save "synth_`i'", replace
}
use "synth_1", clear
forval i=2/39 {
qui merge 1:1 year using "synth_`i'", nogenerate
}
local lp
forval i=1/39 {
local lp `lp' line tr_effect_`i' year, lcolor(gs12) ||
}
* create plot
twoway `lp' || line tr_effect_3 year, ///
lcolor(red) legend(off) xline(1989, lpattern(dash)) ylabel(-30(10)30)
Array
My question is: How to restrict the range of y over the range (-30 to 30)? I do not want the part of the graph above 30 and below -30, similar to the graph in the thread (https://www.statalist.org/forums/for...control-method). Thanks for the suggestions.
0 Response to Graph with restricted range in y-axis?
Post a Comment