Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Break a single report file into separate files 1

Status
Not open for further replies.

Newbie0

Technical User
May 18, 2006
8
US
I'm using SAS EG. I have written my query and used the Summary Tables task to create my report. The output is a single .pdf file. I want to break this report apart into separate (smaller) .pdf files based on a group by field.

So, for example, this report contains information about a bank's regional transactions. I want to distribute each region their particular report that only has their transactions. Since regions can change and there are many doing something in the query is not feasible.
 
I used to do something similar, and I did do it using code. All you need is a reference list of the regions, which usually you can extract from the data you're reporting, then you use that to run a macro loop and write out multiple reports.
I actually put my sample code here:-

You can also be clever and include in it a step which e-mails the report directly to the client.

Are you comfortable writing SAS code in EG or do you need to be able to do stuff through the point and click interface?

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Thanks Chris!!! I do everything in EG, but I am not afraid of writing SAS code. I don't know a lot, but I have some great resources. I appreciate your help and I am pretty confident I can incorporate this into my EG project.
 
Newbie0,
If you are running SAS on a windows OS you can cheat an do the following. First your have your SAS program generate a PDF output normally (ODS PDF). Make sure that in the PROC REPORT you use the BY variable. THis will automatically create bookmarks in the PDF. (You can 'play' with your sas code and have much greater control as to the name of the bookmarks)

Then download the "PDF Split-Merge" ( commandline version (aprox $40 USD).
Have your SAS program call this application via a system function command and your PDF will split into one file per bookmark. (Real fast too!)

Here is a sample:
Code:
ODS PDF File="C:\temp\test.pdf";
proc report data = final nowd;
columns var1 var2 var3;
by customerno;
run;
ods pdf close;

data _null_;
  PDFCommand = '"SplitMerge.exe" bookmark "c:\temp\test.pdf" "c:\target_dir\your_prefix"';
  x = system(PDFCommand); 
run;

The new pdf files will be in the target folder and have the prefix + bookmark name you assigned.
I hope that this helps you.
Klaz
 
Thank you, Klaz! I will definitely look into this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top