Stata 15 help for saving_option

[G-3] saving_option -- Option for saving graph to disk


saving_option Description ------------------------------------------------------------------------- saving(filename [, suboptions]) save graph to disk ------------------------------------------------------------------------- saving() is unique; see repeated options.

suboptions Description ------------------------------------------------------------------------- asis freeze graph and save as is replace okay to replace existing filename -------------------------------------------------------------------------


Option saving() saves the graph to disk.


saving(filename [, suboptions]) specifies the name of the diskfile to be created or replaced. If filename is specified without an extension, .gph will be assumed.


asis specifies that the graph be frozen and saved just as it is. The alternative -- and the default if asis is not specified -- is known as live format. In live format, the graph can continue to be edited in future sessions, and the overall look of the graph continues to be controlled by the chosen scheme (see [G-4] schemes intro).

Say that you type

. scatter yvar xvar, ... saving(mygraph)

That will create file mygraph.gph. Now pretend you send that file to a colleague. The way the graph appears on your colleague's computer might be different from how it appears on yours. Perhaps you display titles on the top and your colleague has set his scheme to display titles on the bottom. Or perhaps your colleague prefers the y axis on the right rather than the left. It will still be the same graph, but it might have a different look.

Or perhaps you just file away mygraph.gph for use later. If you store it in the default live format, you can come back to it later and change the way it looks by specifying a different scheme or can edit it.

If, on the other hand, you specify asis, the graph will look forever just as it looked the instant it was saved. You cannot edit it; you cannot change the scheme. If you send the as-is graph to colleagues, they will see it in exactly the form you see it.

Whether a graph is saved as-is or live makes no difference for printing. As-is graphs usually require fewer bytes to store, and they generally display more quickly, but that is all.

replace specifies that the file may be replaced if it already exists.


To save a graph permanently, you add saving() to the end of the graph command (or any place among the options):

. graph ... , ... saving(myfile) ... (file myfile.gph saved)

You can also achieve the same result in two steps:

. graph ... , ...

. graph save myfile (file myfile.gph saved)

The advantage of the two-part construction is that you can edit the graph between the time you first draw it and save it. The advantage of the one-part construction is that you will not forget to save it.

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index