BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I want to ouput a pair of charts created in proc gchart but I want to output them on the same page and am using proc greplay to do so. I only want to output from the greplay procedure and not the gcharts so I want them to be ignored by ODS. I think I have seen somewhere that ODS output can be stopped temporarily by using something like ODS PDF STOP; and then continued.

Does anyone know how this can be done?

Thanks,
8 REPLIES 8
Cynthia_sas
SAS Super FREQ
Hi,
Rather than "pause" ODS, I suggest taking a different approach:
[pre]

** 1st SAS/Graph pgm for chart (outside ODS "sandwich");
** 2nd SAS/Graph pgm for chart (outside ODS "sandwich");

ods pdf file='somefile.pdf';
proc greplay igout=work.gseg
tc=sashelp.templt template=v2s nofs;
treplay 1:gchart 2:gchart1;
run;
quit;
ods pdf close;

[/pre]

Basically, make sure that ONLY the GREPLAY step is inside the ODS "sandwich" for ODS PDF.
So you'd create all your graphs first in the work.gseg catalog and then do the greplay.

When replaying to PDF or sending graph output to PDF in general, you may find this Tech Support paper to be useful:
http://support.sas.com/techsup/technote/ts659/ts659.pdf

It discusses some techniques that you may find helpful including ODS-based approaches and GSFNAME approaches and ODS LAYOUT approaches.

Good luck,
cynthia
Olivier
Pyrite | Level 9
If you want to stick to your idea of "pausing" ODS (although I agree with Cynthia's point of view), you can do something like :

ODS PDF EXCLUDE yourGraphName(s) ;

This will prevent your charts from being displayed in the PDF document. The names are those that you will mention in the Greplay procedure (Gchart and Gchart1 in Cynthia's example) ; if there are several, list them space-separated.

To resume normal display, just submit :

ODS PDF SELECT ALL ;

This will reset the ODS PDF "black list" of things not to include. This works for each and every object sent through ODS, and for all ODS destinations except ODS OUTPUT.

Regards
Olivier
Cynthia_sas
SAS Super FREQ
Hi:
This might work (using ODS PDF Exclude) IF the output object was coming from ODS GRAPHICS -- but I'm not sure that ODS PDF Exclude works for/with SAS/Graph output:
ODS PDF EXCLUDE GCHART;

I tried it in SAS and got an "An error has occurred during H method OM_C......"

cynthia
Olivier
Pyrite | Level 9
Hi Cynthia.
This is strange because I've tested the ODS EXCLUDE statement on a GCHART procedure before sending my post ; and it worked perfectly alright.
I've just checked again, to be sure, and still no error (on both 8.2 and 9.1.3 SP4).

Weird message that you have, anyway ?!

Olivier
Cynthia_sas
SAS Super FREQ
Olivier...
If you would post your sample code, then I'll have something to try and if my session crashes again, I can give Tech Support something to start with.
Thanks, cynthia
(or if you prefer, you can email it to me at cynthia.zender@sas.com)
Olivier
Pyrite | Level 9
Cynthia, can you please try this code ? It works perfectly on my computer...

ODS PDF FILE = "c:\temp\test.pdf" ;
ODS PDF EXCLUDE gchart gchart1 ;
PROC GCHART DATA = sashelp.class ;
VBAR sex ;
HBAR age / DISCRETE ;
RUN ;
ODS PDF SELECT ALL ;
PROC PRINT DATA = sashelp.class ;
RUN ;
PROC GREPLAY NOFS TC=sashelp.templt IGOUT=work.gseg;
TEMPLATE = H2 ;
TREPLAY 1:gchart 2:gchart1 ;
RUN ; QUIT ;
ODS PDF CLOSE ;
Cynthia_sas
SAS Super FREQ
Olivier:
Yes, your code is almost exactly what I'd tried. And this time it does works for me. I am no longer getting the error message that I got before, BUT, every time I run the test, SAS pops a PRINTING window that says: [pre]
Now printing
SAS Graph Generic Driver to
HP LaserJet 5/5M PostScript
[/pre]
...and my only choice on that window is to hit CANCEL in which case, a blank page ejects from my printer.

So my weekend reboot (or something) seems to have fixed the cryptic error message. But, in the face of the generic printing window, I think I'd just move the SAS/Graph creation code outside of the ODS PDF "sandwich".

cynthia
deleted_user
Not applicable
With regards the "stopping" of ODS for graphs, depending on your requirements, don't forget GOPTIONS DISPLAY/NODISPLAY. Code GOPTIONS NODISPLAY before your PROC GCHART (or whatever), then code GOPTIONS DISPLAY before PROC GREPLAY.

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
  • 8 replies
  • 1530 views
  • 0 likes
  • 3 in conversation