BookmarkSubscribeRSS Feed
PaulOldenKamp
Calcite | Level 5
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
3 REPLIES 3
Olivier
Pyrite | Level 9
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 ;
DanO_sas_com
SAS Employee
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.
David_SAS
SAS Employee
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 837 views
  • 0 likes
  • 4 in conversation