Announcement

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

  • Saving multiple graphs in folder

    I'm trying to run a do file that generates a few different event-study plots and saves them to a folder. However, it seems to be that when I run the below code, each subsequent graph overwrites the previous one, even though they have different names. Below is an example of my do file with two figures. Is there some obvious solution to this that I'm missing?

    Code:
    ** Figure 1 
    reg code 
    coefplot code 
    graph save "Graph" "Z:/folder/fig1.gph"
    window manage close graph "Graph" 
    
    
    ** Figure 2
    reg code 
    coefplot code 
    graph save "Graph" "Z:/folder/fig2.gph"
    window manage close graph "Graph"

  • #2
    I'll answer my own question here: It seems to be that
    Code:
    graph close
    is the preferred option after
    Code:
    graph save
    , because it clears Stata's graph memory as well.

    Comment


    • #3
      coefplot (which, as you are asked to specify in the FAQ, is a community-contributed command available from the Stata Journal) internally uses Stata's twoway architecture, and like all the twoway commands, allows for the option name(). You can have multiple graphs in memory with different names; you will then not need to graph close to prevent overwriting.

      Comment

      Working...
      X