At a customer's site there has been recently an upgrade from v9.1 to v9.2 and during testing we ran across an issue with PDF reports that have been created using ODS Layout and PROC REPORT.
I have search the forums, the usage notes and the various papers already posted on the differences but until now have not been able to find a solution.
Basically the report is created using 4 datasets and a modified template. The template used is generated using the following code:
/* Create the template for the pdf output */
ODS path sashelp.tmplmst (read) work.template (update);
proc template;
define style mystyles.mypdf;
parent=styles.Printer;
/* Style for the entire page */
STYLE Body /
FONT_FACE = "Verdana, Tahoma, Times Roman"
FONT_SIZE = 10pt
FONT_WEIGHT = medium
FONT_STYLE = roman
FOREGROUND = cx660099
BACKGROUND = CXFFFFFF
;
/* Style for a data cell */
STYLE Data /
FONT_FACE = "Verdana, Tahoma, Times Roman"
FONT_SIZE = 9pt
FONT_WEIGHT = medium
FOREGROUND = CX000000
BACKGROUND = CXFFFFFF
;
/* Style for the page title */
STYLE SystemTitle /
FONT_FACE = "Verdana, Tahoma, Times Roman"
FONT_SIZE = 20pt
FONT_WEIGHT = bold
FOREGROUND = CXFFFFFF
BACKGROUND = CX000099
CELLPADDING = 3
CELLSPACING = 0
;
/* Style for the table title */
STYLE Header /
VJUST = C
FONT_FACE = "Verdana, Tahoma, Times Roman"
FONT_SIZE = 10pt
FONT_WEIGHT = bold
FOREGROUND = CX000000
BACKGROUND = CXFF6600
;
/* Style for page numbering */
STYLE PageNO FROM HeadersAndFooters /
JUST=C
VJUST=B
FONT_FACE = "Verdana, Tahoma, Times Roman"
FONT_SIZE = 8pt
FONT_STYLE = roman
PRETEXT='Pagina '
POSTTEXT=" van ^{lastpage}"
;
/* Styles that can be used for ODS Layout */
/* STYLE LayoutContainer /*/
/* BORDERWIDTH = 1mm*/
/* BORDERSTYLE = Solid*/
/* BORDERCOLOR = Blue (_undef_)*/
/* ;*/
/* STYLE LayoutRegion /*/
/* ;*/
end ;
run;
In order to enable recreation of the issue, find below the code that creates 4 datasets based on SASHELP.PRDSALE. Please note that this just serves as an example.
PROC SQL ;
CREATE TABLE HEADER_LEFT AS
SELECT DISTINCT COUNTRY AS DESCRIPTION LENGTH=64 FORMAT=$64.
FROM SASHELP.PRDSALE
WHERE YEAR = 1994
ORDER BY COUNTRY ;
CREATE TABLE REPORT_DATA AS
SELECT COUNTRY
, REGION
, PRODTYPE
, PRODUCT
, SUM(ACTUAL) AS ACTUAL FORMAT=COMMAX16.2
, SUM(PREDICT) AS PREDICT FORMAT=COMMAX16.2
FROM SASHELP.PRDSALE
WHERE YEAR=1994
GROUP BY COUNTRY
, REGION
, PRODTYPE
, PRODUCT
ORDER BY COUNTRY
, REGION
, PRODTYPE
, PRODUCT ;
QUIT ;
DATA HEADER_RIGHT ;
ATTRIB CODE LENGTH=$32 FORMAT=$32. ;
ATTRIB DESCRIPTION LENGTH=$64 FORMAT=$64. ;
CODE = 'Actual' ;
DESCRIPTION = "Actual sales data as of &sysdate9." ;
OUTPUT ;
CODE = 'Predict' ;
DESCRIPTION = 'Estimated sales for '||put(year(today()),z4.) ;
OUTPUT ;
RUN ;
DATA HEADER_EXTRA ;
ATTRIB DESCRIPTION LENGTH=$128 FORMAT=$128. ;
DESCRIPTION = 'A dynamically generated line with additional report information' ;
RUN ;
The report is generated using the following code (which has already been slightly modified compared to the code used in v9.1)
OPTIONS NODATE NUMBER PAPERTYPE=ISOA4 ORIENTATION=LANDSCAPE ;
GOPTIONS DEVICE=ACTXIMG ;
TITLE ; FOOTNOTE ;
TITLE j=l height=4 '^S={vjust=center cellpadding=5pt font_size=20pt}'
"Subtitle"
j=c height=4 '^S={vjust=center cellpadding=5pt font_size=20pt}'
"Main Title"
j=r height=4 '^S={vjust=center postimage=" / .bmp"}';
FOOTNOTE1 'First footnote';
FOOTNOTE2 'Second, dynamically generated, footnote';
ODS _ALL_ CLOSE ;
ODS PDF FILE=' / .pdf'
STYLE=Mystyles.Mypdf
STARTPAGE=NEVER
NOTOC ;
ODS LAYOUT START COLUMNS=2 COLUMN_WIDTHS=(13 CM 13 CM) ;
ODS ESCAPECHAR="^" ;
ODS REGION HEIGHT=4 CM ;
PROC REPORT DATA=HEADER_LEFT NOWINDOWS ;
COLUMNS ("Countries included" DESCRIPTION) ;
DEFINE DESCRIPTION / DISPLAY '' ;
RUN ;
ODS REGION HEIGHT=4 CM ;
PROC REPORT DATA=HEADER_RIGHT NOWINDOWS ;
COLUMNS ("Definition of data" CODE DESCRIPTION) ;
DEFINE CODE / DISPLAY '' ;
DEFINE DESCRIPTION / DISPLAY '' ;
RUN ;
ODS REGION COLUMN_SPAN=2 HEIGHT=2 CM ;
PROC REPORT DATA=HEADER_EXTRA NOWINDOWS ;
COLUMNS DESCRIPTION ;
DEFINE DESCRIPTION / DISPLAY '' ;
RUN ;
ODS REGION COLUMN_SPAN=2 ;
PROC REPORT DATA=REPORT_DATA NOWINDOWS ;
COLUMNS ("Location" COUNTRY REGION)
("Product Info." PRODTYPE PRODUCT)
("Report Data" ACTUAL PREDICT) ;
DEFINE COUNTRY / GROUP 'Country' ;
DEFINE REGION / GROUP 'Region' ;
DEFINE PRODTYPE / GROUP 'Type' ;
DEFINE PRODUCT / GROUP 'Item' ;
DEFINE ACTUAL / DISPLAY FORMAT=COMMAX16.2 'Actual' ;
DEFINE PREDICT / DISPLAY FORMAT=COMMAX16.2 'Predict' ;
RUN ;
ODS LAYOUT END ;
ODS PDF CLOSE ;
ODS LISTING ;
TITLE ; FOOTNOTE ;
GOPTIONS RESET=ALL ;
In v9.1 this generated a report with the HEADER_LEFT and HEADER_RIGHT table centered in the two columns as defined with ODS LAYOUT. Below this the HEADER_EXTRA table centered over the two columns, followed by the REPORT_DATA tabel centered over the two columns.
Furthermore the title would display the subtitle on the left, the main title in the center and the company logo on the right side.
In v9.2 I lose the company logo and have not been able to get it displayed in the title.
Furthermore the HEADER_LEFT and HEADER_RIGHT table, the HEADER_EXTRA table and the REPORT_DATA gets displayed on separate pages. Additonally the tables are not longer centered, but left aligned.
From the Usage Notes and papers I learned that this can be resolved adding the HEIGHT statement to the ODS REGION statement which I can do for all regions except for the one containing the REPORT_DATA since I do not know in advance how large it will become (the others I can adjust to the biggest possibel situation, although preferably not).
If I do NOT add the REPORT_DATA the HEIGHT option indeed results in the HEADER datasets to be displayed on 1 page together, however adding the REPORT_DATA immediately results in everything being split over seperate pages.
Also adding ODS PDF STARTPAGE=NO prior to the ODS REGION statement did not resolve this.
Any help in overcoming this issue would be highly appreciated.
If required I can mail samples of the outcome of v9.1 versus v9.2.
... View more