3

I read the SAS Help Document, Importing graphics from other applications located here ("mk:@MSITStore:C:\Program%20Files\SAS\SASFoundation\9.2\core\help\graph.chm::/graph.hlp/a000214802.htm"). The documentation reads, as follows:

SAS/GRAPH provides import filters to translate graphics files that are created in other applications into a format that you can use with the SAS System.

To import a graphic into SAS/GRAPH:

With the Graph window or the SAS/GRAPH graphics editor active, select File Import Image.

Use the Import dialog box to select the source directory and graphic file; ensure that the Format field shows the correct source format. (This determines which import filter SAS/GRAPH will use.) Choose OK.

Using the File Import Image menu command, you can import the various file formats into SAS/GRAPH: BMP, WMF, JPEG, GIF, TIFF, PCX, TGA, EPSI, PBM, XWD, DIB, XBM, PNG, PCD, and EMF formats.

Does anyone know if there is a way to program SAS to read in a PNG image automatically without using the SAS/Graph interactive editor?

Thanks.

flag

1 Answer

4

OK, so after a lot of searching and experimentation, I found that the following seems to do the trick (using a bit of the data step graphics interface DSGI):

goptions reset=all hsize=2.5in vsize=2.1in;
title;
footnote ;
data image;
   rc=ginit();
   rc=graph('clear');
   rc=gdraw('image','c:\myone1.png',
            0, 0, 100, 100,'fit');
   rc=graph('update');
   rc=gterm();
run;
quit;

I think a people could find this useful especially for some of the new graphics procedures in 9.2 like sgpanel, sgplot, sgscatter which use ods graphics and therefore do not store the images in a catalog. Using the something like the example above, you could produce your ods graphics output, read the image back into a catalog and use greplay to compbine the image with other grahical output.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.