Knowing where your graphic image files are saved and how they are named is particularly important if you are running in batch mode, if you have disabled the SAS Results window (see the section Viewing Your Graphs in the SAS Windowing Environment), or if you plan to access the files for inclusion in a paper or presentation. The following discussion assumes that you are running SAS on the Windows operating system. If you are running on a different operating system, see the SAS Companion for your operating system.
In the SAS windowing environment, the current folder is displayed in the status line at the bottom of the main SAS window.
When the Work
folder and are not available after your SAS session ends.
If you are running your SAS programs in batch mode, the graphs are saved by default in the same directory where you started
your SAS session. For example, suppose the SAS current folder is C:\myfiles
. If ODS Graphics is enabled, then your graphic image files are saved in the directory C:\myfiles
. Traditional graphics are always saved in a catalog in your Work
directory.
If you are using the LISTING, HTML, and LATEX destinations, you can specify a directory for saving your graphic image files. If you are using a destination in the PRINTER family or the RTF destination, you can specify a directory only for your output file. The remainder of this discussion provides details about each destination type.
If you are using the LISTING destination, the individual graphs are created as PNG files by default. You can use the GPATH=
option in the ODS LISTING statement to specify the directory where your graphics files are saved. For example, if you want
to save your graphic image files in the C:\figures
directory, then you can specify the following:
ods listing gpath="C:\figures";
It is important to note that the GPATH= option applies only to ODS Graphics. It does not affect the behavior of graphs that are created by traditional SAS/GRAPH procedures.
If you are using the HTML destination, the individual graphs are created as PNG files by default. You can use the PATH= and
GPATH= options in the ODS HTML statement to specify the directory where your HTML and graphics files, respectively, are saved.
These options also give you more control over your graphs. For example, if you want to save your HTML file named test.htm
in the C:\myfiles
directory, but you want to save your graphic image files in C:\myfiles\png
, then you can specify the following:
ods html path = "C:\myfiles" gpath = "C:\myfiles\png" file = "test.htm";
When you specify the URL= suboption along with the GPATH= option, SAS creates relative paths for the links and references
to the graphic image files in the HTML file. This is useful for building output files that are easily moved from one location
to another. For example, the following statements create a relative path to the png
directory in all the links and references that the file test.htm
contains:
ods html path = "C:\myfiles" gpath = "C:\myfiles\png" (url="png/") file = "test.htm";
If you do not specify the URL= suboption, SAS creates absolute paths that are hard-coded in the HTML file. These can cause broken links if you move the files. For more information, see the ODS HTML statement in the SAS Output Delivery System: User's Guide.
LaTeX is a document preparation system for high-quality typesetting of mathematical and scientific material. The ODS LATEX statement produces output in the form of a LaTeX source file that is ready to compile in LaTeX. When you request ODS Graphics for a LATEX destination,[10] ODS creates the requested graphs as PostScript files by default, and the LaTeX source file includes references to these graphic image files. You can compile the LaTeX file, or you can ignore this file and simply access the individual PostScript files to include your graphs in a different LaTeX document, such as a paper that you are writing. You can specify the PATH= and GPATH= options in the ODS LATEX statement, as explained previously for the ODS HTML statement; see Example 21.3 for an illustration. The ODS LATEX statement is an alias for the ODS MARKUP statement with the TAGSET=LATEX option. For more information, see the SAS Output Delivery System: User's Guide.
The default image file type for the LATEX destination is PostScript. When you use LaTeX to compile your document, the graphics format for included images is PostScript. However, if you prefer to use pdfLaTeX, you can specify a different format, such as JPEG, PDF, or PNG, any of which can be directly included in your pdfLaTeX document. To specify one of these formats, you use the OUTPUTFMT= option in the ODS GRAPHICS statement. For more information,
see the LaTeX documentation for the graphicx
package.