Previous Page | Next Page

Printing with SAS

Creating Portable Network Graphics Using Universal Printing


Overview of Portable Network Graphics (PNG) in SAS


Portable Network Graphics in SAS

Portable Network Graphics (PNG) is a raster image format that was designed to replace GIF and TIFF image formats that are viewed on the World Wide Web. PNG images that are created with a SAS Universal Printer or a SAS/GRAPH device driver use the PNG Reference Library, Version 1.2.8, also known as libpng. The PNG device is the default graphics device for ODS HTML destinations.


The PNG Universal Printers

SAS provides three PNG Universal Printers.

PNG produces PNG images at 96 dpi using a paper size of 600x800 pixels
PNGt produces PNG images at 96 dpi using a paper size of 600x800 pixels with a transparent background
PNG300 produces PNG images at 300 dpi using a paper size of 1875x2500 pixels


Producing PNG Images for ODS Destinations

Use the ODS Listing, Printer, or HTML destinations to create PNG images. For PNG images created by SAS/GRAPH devices, use the ODS Listing and ODS HTML destinations. For PNG images created by Universal Printers, use the ODS Printer destination. For information about creating PNG images by SAS/GRAPH devices, see SAS/GRAPH: Reference.

To create PNG images using Universal Printers, specify a PNG Universal Printer as the value of the PRINTERPATH system option, and the ODS PRINTER statement as shown in the following example:

options printerpath=png;
ods listing close;
ods printer;

...more SAS code...

ods printer close;
ods listing;

SAS creates a PNG file with the name sasprt.png.


Web Browsers and Viewers That Support PNG Files

Although many browsers support PNG images, the following browsers, using the specified version or later, support most PNG image capabilities:

For more information about browsers and viewers that support PNG images, see the PNG Web pages at www.libpng.org.

Creating PNG Files Using ODS Printer

To create a PNG image in SAS using one of the PNG Universal Printers, specify the PNG printer in the PRINTERPATH= system option and the ODS PRINTER statement as shown in the following example:

options printerpath=png;
ods listing close;
ods printer;
data hat;
   do x=-5 to 5 by .25;
      do y=-5 to 5 by .25;
         z=sin(sqrt(x*x+y*y));
         output;
      end;
   end;
proc g3d data=hat;
   plot y*x=z/ctop=red;
   title 'Cowboy Hat with G3D';
run;
quit;
ods printer close;
ods listing;

The following output is the PNG graphic displayed in Internet Explorer:

[untitled graphic]

You can create PNG images for any procedure out. You are limited only by what fits on the paper size that is used to define the size of the image.

Previous Page | Next Page | Top of Page