Announcement

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

  • graph save error

    The following example in Stata 16.1 on a PC and Stata 12.1 on a Mac produces the same error:

    Code:
    sysuse auto
    scatter price mpg
    graph save A
    will return

    Code:
    File A.pgh could not be opened
    This simple code is to reproduce an error that now is returned when I run a similar do-file. I know this syntax used to work because the graphs in my paper were made using it. Does anyone know why this now fails to save a temporary file called A.gph that I can call later with graph combine?

  • #2
    Did you try "graph save A , replace"?

    Comment


    • #3
      I cannot replicate your difficulty. The code works normally on my setup.

      Perhaps the problem is that your current working directory is one for which you do not have write privileges? Try launching Stata from some directory where you have recently saved datasets or graphs and try it there. My guess is it will work just fine.

      Some asides. -graph save A- would create a permanent, not a temporary file. You don't need to save the graph in a file in order to later use it with -combine-. You can do -scatter price mpg, name(A, replace)-, and Stata will store the graph in memory. Then, provided you have do not clear graphs or exit Stata, you can then use it with -graph combine-.

      Comment


      • #4
        I think you're on to something Clyde. It may be that I manually set my working directory when I originally wrote the do-file so that the do-file ran without having to specify a directory. But your name() option is exactly what I was looking for, thank you!

        Comment

        Working...
        X