Desktop productivity for business analysts and programmers

Add a Banner to Report with dynamic variables

Reply
Occasional Contributor
Posts: 15

Add a Banner to Report with dynamic variables

I'm totally new to EG (ver 5.1) and need some help putting all the pieces of a Report together that will run multiple iterations.

First  I need to add a banner to the top of the report that will change with each iteration of the data: i.e  Group:  Acme Athletics  Location: Smallville  Type: Senior

The data is being created by Group, but from multiple programs, and the Report is a combination of graphs and text.  I feel like I need one big macro to bundle it all together, plus add the touches like Group name, Location, etc.  Of course each part has to be a specific font and Color.  There is also a logo in the Header area -- that was added by referencing a .jpeg file in the Image section of Report> Header/Footer.

As each Group report is created, they need to be saved to a .pdf named for each group.  Any help would be appreciated.  Thanks

Super User
Posts: 19,160

Re: Add a Banner to Report with dynamic variables

What does a banner mean to you?

Is it just text?

If so and you're using PDF as a destination you can look into the ODS PDF TEXT Line.

It does sound like you'll need a macro if you want different files for each group, so the macro variables for the group/location/type can feed into the ODS PDF TEXT Line.

Occasional Contributor
Posts: 15

Re: Add a Banner to Report with dynamic variables

The banner is a 1 inch section at the top of each page of the report.  On the left is the logo, on the right are text values such as

GROUP:  &groupname  LOCATION:  &locname.  Under the banner is a line delineating the banner from the rest of the document.

Could you please show an example?  There are so many ODS PDF references.  Thanks

SAS Super FREQ
Posts: 8,820

Re: Add a Banner to Report with dynamic variables

Hi:

  This is an example that's probably similar to one I've posted before. I'd recommend you search the foum and/or open a track with Tech Support. You haven't shown any code or even any example of what you want. You seem to have some ideas, of using macro variables, but seeing the macro variables in the context of your code might be helpful to anyone wanting to come up with a sample for you. Otherwise, somebody might be foolish enough to spend time on an example for you and then you might say "oh, no, that's not how I'm using macro variables" or some such.

  That's why I didn't spend a lot of time on the example, this is one I've used before, so you will notice that there's no underline and the "logo" (kermit.gif) is specified on the right, not the left. But, assuming you have c:\temp\kermit.gif (or some other image) on you system, this code should be fairly easy for you to modify and run as a conceptual proof of the ability to change title "banner" strings in between report steps.

cynthia

options nodate number;
ods listing close;

** use blank title 1 to put some space under page number;
%let ttext = Title 1;
%let comp=My FIRST Company;

     

ods pdf file='c:\temp\logo_alt.pdf';
ods escapechar='~';
title ' ';
title2 j=l "~S={vjust=m} &ttext" j=c "&comp"
       j=r '~S={preimage="c:\temp\kermit.gif"}';
                             
proc report data=sashelp.shoes(obs=6) nowd;
  where region = 'Canada';
  column region product sales;
  define region / 'Region';
run;

    

** second report;
%let ttext = Title 2;
%let comp= My OTHER Company;
ods escapechar='~';
title ' ';
title2 j=l "~S={vjust=m} &ttext" j=c "&comp"
       j=r '~S={preimage="c:\temp\kermit.gif"}';
     
proc report data=sashelp.shoes(obs=6) nowd;
  where region = 'Western Europe';
  column region product sales;
  define region / 'Region';
run;

ods pdf close;
title;

Super User
Posts: 19,160

Re: Add a Banner to Report with dynamic variables

If you're totally inexperienced with SAS I'd recommend a different route to start off with.

If your tables are fixed length, one option that's relatively straightforward is to create a template in excel and then populate that template using SAS and some exports.  Excel 2010 will allow you save a file as a PDF that will have the characteristics that you want.  Its not a bad way to start off to "prototype" a report regardless as it allows you to change things more easily.

Ask a Question
Discussion stats
  • 4 replies
  • 238 views
  • 0 likes
  • 3 in conversation