The SAS Output Delivery System and reporting techniques

PDF outputs

Reply
Contributor
Posts: 35

PDF outputs

I am using EG3 to create a large series of graphs of which I only need some. Rather than 1 complete PDF with all graphs, is there a way I can automate production of these graphs into separate PDF files that have file names generated by the "group by" variables used in the graph code?

In essence, I have:

Myfile.pdf
Page 1) Tom graph
Page 2) Rob graph
Page 3) Jan graph

but I need:
Tom.pdf
Rob.pdf
Jan.pdf

Where Tom, Rob, and Jan are possible values in my Groub By variable.
SAS Super FREQ
Posts: 8,743

Re: PDF outputs

Hi...if you use a code node in EG, you can "sort" of generate the separate PDF files. There's an upside and a downside. The upside is that if you use NEWFILE=BYGROUP, the files get created automatically. The downside is that you can only "sort of" control the name of the file. For example, with the attached code:
[pre]
proc sort data=sashelp.prdsale out=prdsale;
by division prodtype;
run;

options orientation=landscape topmargin=1in bottommargin=1in
rightmargin=1in leftmargin=1in nodate number pageno=1;
run;

ods pdf file="c:\temp\GRFBY1.pdf" newfile=bygroup;

GOPTIONS reset=all device=actximg;

PROC GCHART DATA=prdsale;
title 'The Graph Title';
VBAR3D region / SUMVAR=actual
GROUP=product
SHAPE=BLOCK
FRAME TYPE=SUM
PATTERNID=MIDPOINT;
BY division prodtype;
format actual dollar12.2;
RUN; QUIT;

ods _all_ close;
title;
footnote;
ods listing;

[/pre]

If the SAS dataset has 4 BY groups, then the PDF output files will be named: GRFBY1.PDF, GRFBY2.PDF, GRFBY3.PDF, GRFBY4.PDF -- which means you can control the "beginning" part of the name, but NEWFILE= option wants to number the output files by incrementing the right-most number in the starting file name by 1 for each BYGROUP (in this example). Of course, after the files were created in c:\temp, you could go and issue a RENAME to name them what you wanted.

Your only other alternative would be to "macroize" the program to produce a single BY group -- and then you can control the name of every BY group's file -- when you invoke the macro program for each group. And then you could call the files Tom.PDF, Rob.PDF and Jan.PDF. (or whatever else you wanted).

Good luck!
cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 115 views
  • 0 likes
  • 2 in conversation