Your SAS programs, embedded in web apps and elsewhere

Printing Reports Generated in SSP

Reply
Contributor
Posts: 33

Printing Reports Generated in SSP

Hi,
I would like to know if there is a possibility to send a report to printer if it is generated in the SSP with PROC REPORT. If the report is long enough I would like to add footnotes at the end of each page with page numbers. Is it possible? Thanks.
SAS Super FREQ
Posts: 8,743

Re: Printing Reports Generated in SSP

Hi:
When you use the acronym SSP, you mean SAS Stored Process??

PROC REPORT can produce output with titles and footnotes and page numbers -- but only in paged destinations. So, for example, if you ran your stored process in the information delivery portal and returned HTML results from your stored process, then you would see the titles and footnotes that you used with PROC REPORT, but there would not be any page numbers, because page numbering is not part of the HTML specification. That's why ODS HTML is not considered to be a "paged" destination.

In the same fashion, if your stored process is populating a section in a Web Report Studio report, Web Report Studio has its own interface for printing and I believe that you will see the titles from PROC REPORT - -but not any page numbers, because WRS does its own process to allow you to print your output to a PDF file.

So, when you say you want to send a report to a printer, my question is how your users are going to request that stored process should run??? They will only see page numbers in destinations that support page numbers. There is an ODS PRINTER destination. However, you would need to know the EXACT name of the printer in order to send stored process results directly to a printer. Will you know the EXACT name of the printer for EVERY user of the stored process???

I would recommend that you explore a stored process that creates PDF output -- PDF output is a file format that contains your output -- in a printer-ready or printer-friendly format. Your PDF results from a stored process can have page numbers and titles and footnotes. (So could your RTF results from a stored process.) Client applications that can receive PDF output are: EG, the Information Delivery Portal and the Stored Process Web Application. Client applications that can receive RTF output are: EG, the Information Deliver Portal, the Stored Process Web Application and the SAS Add-in for Microsoft Office/Microsoft Word.

If I run this stored process in SAS Enterprise Guide, I do get a PDF file with 4 pages of output and the page number is in the footnote at the bottom of each page (the default location for the SAS page number is in the upper right hand corner of the PDF output).

When the PDF file is displayed, inside EG, I can use CTRL+P to print or, if I save and then view the file with Adobe Acrobat Reader, I can use the Reader print button to initiate printing.

If your destination of choice is RTF, you can also create an RTF file and return the results to either EG or the SAS Add-in for Microsoft Office using Microsoft Word.

cynthia

[pre]
*ProcessBody;

%let _ODSDEST = PDF;
%let _ODSSTYLE = printer;
%let _odsoptions=notoc;
%let _odsstylesheet=;

options orientation=portrait nodate nonumber center;

%stpbegin;

ods escapechar='^';

proc report data=sashelp.shoes(obs=100) nowd;
title 'This is Title1';
title2 'This is Title2';
footnote 'This is Footnote1';
footnote2 j=l 'Page: ^{thispage}';
column region product sales inventory returns;
define region / order;
define product / order;
define sales / sum;
define inventory / sum;
define returns / sum;
break after region / summarize;
rbreak after / summarize;
run;
%stpend;
[/pre]
Contributor
Posts: 33

Re: Printing Reports Generated in SSP

Hi Cynthia,
thanks a lot for your replay. Yes, by the "SSP" abbrevation I meant SAS Stored Process. Thanks a lot for a hint about PDF output. That's definitely is the best way to print the reports. I still have few questions:

1. I have multiple proc report procedures that generate multiple tables in the same SSP and I would like to add a front (or title) page describing the document. Is this feasible?

2. Is there a possibility to specify the width of the columns explicitly? I tried to add WIDTH option in the DEFINE statement, but this didn't work out. I also tried to add the width in the PROC REPORT styles for headers option :

proc report data=&table nowd
style(header)=[width=50 ]
...

but this resulted in making all columns the same width which is not good either.

3. PROC REPORT returns a table where the first column is descriptive. Some of the values in that column need to have an increment relatively to other values. For and HTML output I use this compute statement:

compute kpi_description;

if font='I' then kpi_description = trim(left('     ' !! kpi_description));

endcomp;

But it does not work for the PDF output. Instead of spaces I see the   symbols added to the value of the KPI_DESCRIPTION column. Do you have any ideas how this could be implemented for the PDF output ?

Thanks a lot!
Sarunas
SAS Super FREQ
Posts: 8,743

Re: Printing Reports Generated in SSP

Hi:
Again, it depends on the client application. for example, you could do this:
[pre]
define name / display style(header)={background=purple}
style(column)={width=2in};
define age / sum style(header)={background=yellow}
style(column)={width=1in};
[/pre]

...in other words, put an explicit width on your define statements. And, do use a unit of measurement -- without any unit, I believe the default unit is PIXELS, which might not be sized as you want. Do keep in mind, however, that not all client applications will use these style specifications. For example, Web Report Studio might not use these widths at all. On the other hand, if you are generating PDF output, then you will be returning the output to either EG or the Information Delivery Portal or the Stored Process Web App -- so that should be OK in the PDF file.

About the title page -- there are a couple of ways to generate title pages. One way is to build a SAS dataset with the title page lines and then generate the title page with PROC REPORT (using NOHEADER to suppress the column headers and using STYLE overrides to adjust the size of each title line). Another way is to use ODS LAYOUT. The first method has been shown at least once in a forum posting here. The second method was illustrated in a SAS Global Forum paper about ODS LAYOUT.

I'm not sure I completely understand your #3 and what you mean by "increment" -- it actually looks like you are trying to indent by padding the variable value with spaces. (which is more of a LISTING technique). ODS PDF (and other ODS destinations) generally ignore leading spaces unless you use the ASIS=ON style attribute or explicitly set an INDENT level with the INDENT= style attribute or explicitly change the LEFTMARGIN of the cell using the LEFTMARGIN= style attribute. I would recommend that you work with Tech Support on your #3.

cynthia
Contributor
Posts: 33

Re: Printing Reports Generated in SSP

Hi Cynthia,
thanks very much for your help! It all worked out. I am currently struggling with one problem - I want to have a page of content in my pdf. But if I specify in the ODS statement an option CONTENT=YES, the page of content always appears first in the pdf document and then the title page. Is there a way how can I first print out the title page and only then the page of content. Thanks a lot.
SAS Super FREQ
Posts: 8,743

Re: Printing Reports Generated in SSP

Hi:
I believe you have a timing issue with how pages are produced. In a single PDF file, the Table of Contents page [b[always comes first. So the only workaround I can think of is to create 2 PDFs-- one with a Title page and the second with your TOC and report output and then you would combine the 2 PDF outputs into 1 PDF. You would not, however, use SAS to combine the 2 PDFs into 1 PDF -- you would have to use Adobe Acrobat or some other 3rd party PDF tool to combine the 2 PDFs together.

The other alternative might be to use ODS LAYOUT. However, you would have to work with Tech Support on this one...because
1) ODS LAYOUT is still experimental
2) I'm not sure how it will work in the context of the BI Platform
3) In the BI Platform, I don't know which client applications will be able to work with ODS LAYOUT output

cynthia
Ask a Question
Discussion stats
  • 5 replies
  • 315 views
  • 0 likes
  • 2 in conversation