I have the following code:
graph drop _all
sts graph if year==2014, saving(14)
sts graph if year==2015, saving(15)
sts graph if year==2016, saving(16)
gr combine 14.gph 15.gph 16.gph
I would like to add a line that will clear the previous graph from the memory or rewrite it.
I have tried: graph drop _all. This doesn't work. Graphs are not cleared. I have also tried putting a replace command after the codes above, like this:
sts graph if year==2014, saving(14) replace
sts graph if year==2015, saving(15) replace
sts graph if year==2016, saving(16) replace
gr combine 14.gph 15.gph 16.gph
But sts doesn't work with replace.
Any other suggestions?
From the manual:
The replace option should go inside the pair of parentheses. Try this:
sts graph if year==2014, saving(14, replace)
sts graph if year==2015, saving(15, replace)
sts graph if year==2016, saving(16, replace)