The SAS Output Delivery System and reporting techniques

SAS/Graph ==> ODS Document ==> PDF

Reply
Occasional Contributor
Posts: 7

SAS/Graph ==> ODS Document ==> PDF

Hello,

I’m interested in producing several graphs with gplot, outputting them to an ods document store, and then selecting some or all of the graphs and producing pdf or rtf output.

I’m following examples 9.6 and 15.6 in the Windows ‘SAS help and Documentation’ and the ods document information on graphics in the Base Community web pages.

What I get in the final pdf document when I generate the graph with gplot with the java or javaimg device driver is a small graph that is compressed horizontally and has a thick gray outline. It’s not at all what appears in the graph window when I use the win driver.

The information on how to do this is very sketchy and that makes it very difficult to do the necessary debugging.

The Base Community instructions say to use ods styles to control the look of the graph instead of goptions settings so that the ods documents are more portable. How does one do this?

Does anyone have some better examples to follow? How and where can one RTFM?

Paul OldenKamp
Super Contributor
Posts: 260

Re: SAS/Graph ==> ODS Document ==> PDF

Posted in reply to PaulOldenKamp
I tried this program having no problem.
Does my sample program meet your needs ?

ODS DOCUMENT NAME = sasuser.test ;
GOPTION DEVICE = JAVAIMG ;
PROC GPLOT DATA = sashelp.class ;
PLOT (weight height) * age ;
RUN ; QUIT ;
ODS DOCUMENT CLOSE ;

ODS PDF FILE = "c:\temp\test.pdf" ;
PROC DOCUMENT NAME = sasuser.test ;
REPLAY / LEVELS = ALL ;
RUN ; QUIT ;
ODS PDF CLOSE ;
SAS Employee
Posts: 16

Re: SAS/Graph ==> ODS Document ==> PDF

Posted in reply to PaulOldenKamp
This is because each output destination uses is own internal default device driver (WIN on windows), but SASPRTC for the PDF destination. When you created the grseg in the document it was created using the WIN device which has device dependant characteristics like the height and width. These device characteristics are permanetly saved as part of the grseg, so when you replay the grseg from the document to the pdf destination you are going to get the size of the creation device not the replay device. Here you are using the default PDF device to create the grseg, and you will see a image that is very different in size than the replayed one because the SASPRTC device has a default width of 8in and a default Height of 10.5in.

ods pdf file="c:\test.pdf";
PROC GPLOT DATA = sashelp.class ;
PLOT (weight height) * age ;
RUN ; QUIT ;
ods pdf close;

You can override the default devices by using the goption device=JAVAIMG; , but keep in mind that the grseg will be created with the creation device characteristics not the replay characteristics. You can further manipulate the graph by specifying additional goptions.

NOTE: For v9.1.3 You will receive the best results when running SAS/GRAPH procs with only 1 output destination open at a time to avoid creating a grseg with one device and replaying using another. You may receive some unpredictable results. We have done extensive work in v9.2 to alleviate much of this pain.
SAS Employee
Posts: 174

Re: SAS/Graph ==> ODS Document ==> PDF

Posted in reply to PaulOldenKamp
As you can see, the interactions between ODS and SAS/GRAPH are complicated in SAS 9.1. It's important to know that graphics generated with legacy GRSEGs are done in a completely different way than with the java/javaimg and activex/actximg devices. I prefer the latter when using an ODS document because the raw data for the graph is persisted. When you use GRSEGS, really all that gets persisted is a reference to the GRSEG, which has already been rendered based on the characteristics of the creation device, as Dan mentioned. It is fully cooked.

The java/activex (so-called "client") graphics get rendered when the document gets replayed based on the output destination styles in effect. They behave like tables always have behaved in ODS. You have control over the presentation characteristics of the graphics. Also, because the raw data is persisted, you can use the ODS OUTPUT destination to dump the data into a data set!

If you prefer GRSEGs, then they'll work for you. But they're less flexible. Also, you have to ensure that GRSEG catalogs persist at least as long as the document that references them. If that's an issue, I can show you how the ODS DOCUMENT destination helps you with it.

-- David Kelley, SAS
Ask a Question
Discussion stats
  • 3 replies
  • 209 views
  • 0 likes
  • 4 in conversation