Desktop productivity for business analysts and programmers

How to combine multiple reports

Not applicable
Posts: 1

How to combine multiple reports

I have been working on process for creating a monthly report made up of 300-700 graphs. The graphs will highlight a handful of metrics across many different segments and sub-segments. As such I need to group the graphs by their respective segments. It is preferable to have multiple graphs on a page. (Note: when more then 6 graphs are needed for a segment it is preferred that the additional graphs be placed on the following page.)

Picture a series of graphs segmented and presented in a 10 page report with the following layout....

  1. Prime Loans
    1. 2011
      1. Defaults (6 graphs on page 1)
      2. Prepayments (4 graphs on page 2)
    2. 2010
      1. Defaults (7 graphs, graphs 1-6 on page 3 and graph 7 on page 4)
      2. Prepayments (4 graphs on page 5)
  2. Subprime Loans
    1. 2011
      1. Defaults (8 graphs, graphs 1-6 on page 6 and graphs 7&8 on page 7)
      2. Prepayments (5 graphs on page 8)
    2. 2010
      1. Defaults (6 graphs on page 9)
      2. Prepayments (3 graphs on page 10)

From what I was able to determine it is fairly easy to segment data in EG by using "Data" --> "Group Charts By". Unfortunately all the graphs come out on one very long series of pages and from what I can tell I have no ability to control how many graphs are on a page or where page breaks occur.

Given this limitation I thought maybe another option might be to create each graph as its own EG Node and then create a one page report for each one of the pages in the report. this way I could control the number of graphs per page and their layout. In the above example this would turn out to be 10 reports. If I were to do this is there a way for me to role all 10 reports into one master report? It seems as if my EG project could become quite unwieldy if one can imagine 300-700 individual nodes in one EG project.

One last thing to note: My final report will have many pages and it will be necessary to have bookmarks (example: Prime & Subprime), sub-bookmarks (example: 2011 & 2010), etc. in order for the reader to be able to navigate my large report. Is there a way to create these types of links in my final report and if so is there a way for me to nest bookmarks for sub-segments, sub-sub-segments, etc.?

Is there a way to create this type of segmented report using one of the methods I listed above or is there a different process in EG that I should consider?  Thanks in advance for your time and input.


Posts: 46

Re: How to combine multiple reports

Posted in reply to thinkoutside

There is a way to group reports into one master report(although I have not had as many reports as you are using) is very similar to Web Report Studio reports. Right-click on an existing report and choose "Create Report". It has some limitations, but it is handy for getting several smaller reports to print on the same page (

Posts: 9,431

Re: How to combine multiple reports

Posted in reply to thinkoutside


  There are several different avenues you could pursue. But basically it's going to come down to the same thing:

1) Get ALL your 44 graphs working for 1 segment or sub-segment (if I add up all the separate graphs for 1A, 1B, 2A and 2B, I get 44 graphs).  You are correct that BY group processing isn't really going to help you here, because, one graph will be produced for EVERY unique value for the BY group before moving to the next graph.

2) You are not going to be able to worry about assembling a document or pagination of the document until you have working code to generate the entire set of graphs for 1 segment. -- this probably means taking out all your BY statements and replacing them with a WHERE statement -- so you can produce each graph for 1 segment in the order of display that you want. At some point, if you are using SAS/GRAPH, you will want to go through and make sure that each graph gets a unique name, using the NAME= option (in the code), even if it's only a 1 or 2 character name because otherwise, SAS/GRAPH will just use the procedure name over and over again with a number suffix. Down the road, you will want to be able to grab just 1 or 2 graphs and knowing their names will be useful.

3) Then, you have to realize that generating the graphs for one segment is only the first place to start. Usually when people need to generate a set of different graphs, but all for the same group, they end up wrapping ALL their code for ALL the graphs in a SAS Macro program, so the entire set of programs can be generated over and over for an entire region or country or, in your case, segment. This means that once you have a complete set of programs that produces ALL the graphs for 1 segment, you will want to turn that whole set of programs into a SAS Macro program so it can be repeated for multiple segments. You can use the WHERE clause that you added in #2 to take a macro variable that identifies the segment, so for the first run, all the WHERE statements would become something like:

where segment = "&wants" and then when you invoked the macro program you'd have something like:

%makegrf(wants=Segment1) or


  There's a lot more to making a macro program than I have space to go into here -- but generally speaking -- if you need to produce a whole set of graphs or reports for all of one country or one region or one segment, you would use Macro programming and macro variables to make it happen. But I would recommend that you know that your macro program can generate all the graphs that you need for all the segments and then move into document production.

4) Next you have to figure out how to assemble your graphs into your final document. That means you have to figure out what destination or mechanism you are going to use to deliver your document. Since you keep referring to pages, it sounds like this will be a printed document. There are only 2 destinations that support pagination -- those are the PDF and the RTF destinations. I believe that if you create a report in EG using SASReport XML and the Report builder in EG, you can also assemble documents with page breaks, however, this is exclusive to EG and I'm not sure how you could or whether you could assemble your document(s) for 300-700 graphs total in an automated fashion with EG. So, choices for assembling your final document are:

   a) Use EG to build the graphs (probably in a project that would produce the WHOLE set of graphs for 1 setment) and then build an EG report from the graph output in your tasks -- how you would automate the internal EG report building process for all your segments is still TBD, might be a question for Tech Support or for more experienced folks in the EG forum. (although the link that was previously posted for the tutorial on the Report Builder seems a good place to start)

   b) Use EG to build the graphs, because EG is fast and easy to build graphs. Then, grab the code that EG generates -- grab what you need for an entire set of graphs and then wrap that code in a SAS macro program that you could run over and over for each segment (points back to #3 above). Before you finalize your macro program, you will have to decide how you're going to accomplish the pagination and you'll have to test building the final document (my guess would be in PDF) -- for 1 segment, using your test graphs from #2 above. Then either use ODS LAYOUT or PROC GREPLAY (two alternative methods) to assemble your graphs into a model of your final document. Once you get this piece working, you can incorporate the building of the final document for each segment into your macro program.

  What you want to do almost  sounds like a BI Dashboard -- with Key Performance Indicators -- something that you might surface in the Information Delivery Portal. If you did have the BI Platform or the SAS Platform for Business Analytics, that might be yet another approach to the ones listed above.

  It seems to me that for just 1 segment 44 graphs is a LOT to look at and I wonder whether it might be useful for you to review some of the Dashboard examples at this web site. Even if you don't have the BI Platform, it is possible to produce informative dashboards with SAS/GRAPH and PROC GREPLAY, as most of these examples show:

This example makes use of SAS/GRAPH (a LOT of SAS/GRAPH programs) and GREPLAY.  If you added SAS Macro programming into the mix, you could repeat a dashboard like this for another company or another country.(

For some examples of what you can do with ODS LAYOUT capability, refer to this pre-production information:

and this paper: (see Exhibit 3 and Exhibit 7)

Then, if you have the BI Platform, you have some other possibilities, you could use the BI Dashboard capability, you could use stored processes. What you want to do will depend at some level on your system, your software, your delivery method and destination and what you are going to use to generate the code.

In addition to SAS/GRAPH software ("classic" GCHART and GPLOT, GREPLAY, etc) there is also ODS GRAPHICS -- so if some of your graphs needed to come from statistical procedures or you needed to produce paneled plots, like the plots on page 6, 9 and 10 of this paper: -- these plots were produced with the SGPANEL procedure, which is part of ODS GRAPHICS. If you only had SAS 9.1.3, then you would not be able to use SGPANEL. But if you have SAS 9.2 or higher, then SGPANEL is available to you and would be a possible alternative to using SAS/GRAPH and GREPLAY -- if the type of comparative plot you needed to produce was possible with SGPANEL.

I know this doesn't answer your question about producing your document or pagination, but the answer starts with getting all the graphs produced for 1 segment.


Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation