Before increasing the resolution of your graphics output, check to see what you are creating your graphics output with: A traditional SAS/GRAPH® procedure, such as GPLOT or GCHART? An SG procedure, such as SGPLOT? Or SAS® ODS Graphics with a SAS/STAT® procedure?
Using Traditional SAS/GRAPH Procedures
Here are some things that you can do to increase the resolution of your graphics output if you are using a SAS/GRAPH procedure such as GPLOT or GCHART.
First, check your code to see whether you are using older SAS/GRAPH software fonts; font names such as SWISS, CENTB, and ZAPF fall into the “older font” category. If you are using any of these, remove them from your code. Without these older software fonts in your code, SAS will by default create your graphics output with better-looking hardware fonts. For example, the Albany AMT font is one of the newer hardware fonts supplied by SAS.
Which Device Driver?
Next, check your GOPTIONS statement to see which SAS/GRAPH device driver you currently specify for the DEVICE option. If you are writing stand-alone graphics files to disk using a device driver such as PNG, JPEG, or TIFFP, replace these drivers with the PNG300, JPEG300, or TIFFP300 drivers, respectively. The PNG300, JPEG300, and TIFFP300 drivers by default create graphics output with a resolution of 300 DPI (dots per inch). By comparison, the PNG, JPEG, and TIFFP drivers create graphics output with a resolution of 96 DPI.
Using the ODS PDF Statement?
If you are using a SAS/GRAPH procedure together with the ODS PDF statement to write graphics output in PDF format, first be sure to use the SASPRTC device driver in your code, like so:
- goptions device=SASPRTC;
Then, to increase the resolution of the graphics output written to PDF, specify the DPI option in the ODS PDF FILE statement, like this:
- ods pdf file='sastest.pdf' dpi=300;
Using the ODS RTF Statement?
If you are writing your SAS/GRAPH procedure output to RTF using the ODS RTF statement, use the PNG300 device driver in a GOPTIONS statement in your code. Like this:
- goptions device=PNG300;
Using SAS SG Procedures or SAS ODS Graphics
If you are using a SAS SG procedure (such as SGPLOT) or creating graphics output using ODS Graphics with a SAS/STAT procedure, here are some things that you can do to increase the resolution of your graphics output.
If you are writing a stand-alone graphics file to disk using an ODS LISTING statement similar to this:
- ods listing gpath='c:\temp';
Then add the IMAGE_DPI option to the statement above:
- ods listing gpath='c:\temp' image_dpi=300;
Currently, SAS honors the IMAGE_DPI option in the ODS LISTING statement only when you use an SG procedure or ODS Graphics to create PNG or JPEG graphics output.
If you are writing your SG procedure and ODS Graphics output to a PDF file, you can increase the resolution of your graphics output by specifying the DPI option in the ODS PDF FILE statement, like this:
- ods pdf file='sastest.pdf' dpi=300;
If you are writing your SG procedure and ODS Graphics output to an RTF file, you can increase the resolution of your graphics output by specifying the IMAGE_DPI option in the ODS RTF statement, as in the following:
- ods rtf file='sastest.rtf' image_dpi=300;
Also, be sure to specify OUTPUTFMT=PNG in an ODS Graphics statement in your code, as shown here:
- ods graphics on / outputfmt=png;
With the SG procedures and ODS Graphics, once you increase the resolution of your graphics output, you might start seeing java.lang.OutofMemoryError or a Java heap space memory error. If you encounter this problem, see SAS Note 31184, which documents ways to address the issue by changing your SAS configuration file.
One Final Thing to Note...
Most web browsers display graphics output using fairly low resolution. So, in most situations, the resolution of graphics output displayed via web browser, is limited by the web browser itself. Therefore, when displaying graphics output via a web browser, consider creating your graphics output in scalable vector graphics (SVG) format. A previous blog post, “Have you created Scalable Vector Graphics with SAS?” describes how to create your graphics output in SVG format.