BookmarkSubscribeRSS Feed
Resa
Pyrite | Level 9
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.
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
ODS LAYOUT was pre-producation in SAS 9.1.3 and is still pre-production in SAS 9.2 -- that means that syntax and behavior might change between how it worked in one version, what the syntax accomplishes, or what type of syntax you need -- all of this can possibly change before the features are production. Although, it is more likely that the 9.2 behavior and syntax is closest to what will finally be production.

Only Tech Support, at this point, has the setup to test code in 9.1.3 versus 9.2. If you have questions about ODS LAYOUT in particular, you can open a track with Tech Support. Or, you might find other information on these sites:
http://support.sas.com/rnd/base/early-access/index.html (there is a note on this page about some bug fixes that were applied in SAS 9.2 M3)
http://support.sas.com/rnd/base/datastep/dsobject/index.html

cynthia
Resa
Pyrite | Level 9
Hi Cynthia,
Thanks for your reply. I was and am aware of the fact that ODS Layout is pre-production but it was the only way for me to create the report in the way as requested by the customer.

I have read and tried the suggestion in the the several papers on ODS Layout however I have not been able to find a solution. As such I have taken up your suggestion to report this to Support with the request to compare the differences in output.

I really hope they can provide a solution so I can (re)create the reports in a way as requested by the customer.
Resa
Pyrite | Level 9
Please find an update of the current situation regarding this below:
With the help of SAS Technical Support most of the issues have either been explained or (more or less) resolved.

The report now shows the tables no longer on separate pages and only the top two tables are no longer centered (however this is not a major issue). Basically this could be resolved by placing the last two PROC REPORTS outside the ODS LAYOUT section (thus moving ODS LAYOUT END after the two top tables).

The disappearing logo was caused by the fact that we also made use of LASTPAGE. This issue is explained in Problem Note 34573 (http://support.sas.com/kb/34/573.html).

Thanks for all the help provided in overcoming the originally posted issues.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1005 views
  • 0 likes
  • 2 in conversation