The SAS Output Delivery System and reporting techniques

PROC REPORT: difference for HTML and PDF

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 89
Accepted Solution

PROC REPORT: difference for HTML and PDF

dear all,

with PROC REPORT I create a label for a column: DEFINE PROD / GROUP LEFT ORDER=DATA "OFF BALANCE SHEET/Product"

WHen printing it to:

1/ ODS directed to HMTL: ok, "3 words" are on one line, next line "product"!

2/ ODS to PDF:

it stacks everything in 4 lines.

I tried, unsuccessfully, a lot of things

* length prod $20.

* in proc report:   (DEFINE PROD / GROUP LEFT ORDER=DATA "OFF BALANCE SHEET/Product" width=20)

Any ideas??

GreetZ,

Herman


Accepted Solutions
Solution
‎09-23-2011 09:37 AM
Super Contributor
Posts: 394

PROC REPORT: difference for HTML and PDF

The WIDTH option only affects listing output. For non-listing output such as HTML and PDF, add a STYLE option to the DEFINE statement and use a WIDTH style attribute.

View solution in original post


All Replies
Solution
‎09-23-2011 09:37 AM
Super Contributor
Posts: 394

PROC REPORT: difference for HTML and PDF

The WIDTH option only affects listing output. For non-listing output such as HTML and PDF, add a STYLE option to the DEFINE statement and use a WIDTH style attribute.

SAS Super FREQ
Posts: 8,742

Re: PROC REPORT: difference for HTML and PDF

Hi:

  To elaborate a bit on Tim's posting, there are a number of PROC REPORT options (HEADLINE, HEADSKIP, SPACING, WIDTH, SKIP, DOL, DUL, OL, UL, PANELS, FLOW, etc,) that are LISTING only options -- they were designed to work in the LISTING destination and are basically ignored by the other ODS destinations. For more information, refer to:

http://support.sas.com/kb/2/549.html

http://support.sas.com/rnd/base/ods/templateFAQ/report1.html

  HTML and PDF are inherently different destinations -- so you can never guarantee that the output will look EXACTLY the same in both destinations. For example, HTML is not bound by physical page restrictions, so an HTML report can be as wide or as long as it needs to be and the only controls you have for header/column width are the default slash (/) which indicates where a header string should break or the CELLWIDTH= or WIDTH= style attribute (not to be confused with the WIDTH= option that only impacts the LISTING destination).

  On the other hand, PDF is bound by physical page restrictions, as it calculates column width based on a formula that takes all of the following into account: the orientation, the page margins and the size of the font and the cellpadding and cellspacing attributes. So, where a header string might take up only 1 line in HTML, that same string might take up multiple lines in the PDF destination. The use of the default slash (/) allows you to indicate an exact place in which a header string should break. If you run the program below, you will see that I have made the cells different widths (and used some differing justification), without the slash, the destinations use cellwidth to determine the overall look of the column headers. Note the appearance of the PT2 column for example -- it will wrap the header string differently in PDF versus HTML in the absence of any other instructions from me in the STYLE= statement overrides.

cynthia

ods listing close;
options nodate nonumber center orientation=landscape;
ods html file='c:\temp\usecellwidth.html' style=sasweb;
ods pdf file='c:\temp\usecellwidth.pdf';
            
proc report data=sashelp.prdsale(obs=100)
     nowd split='/'
     style(header)={vjust=b just=c};
  column prodtype prodtype=pt2 product actual predict;
  DEFINE PRODTYPE / GROUP "OFF BALANCE SHEET/Product Type"
         style(header)={just=l cellwidth=2in}
         style(column)={just=l};
  DEFINE pt2 / GROUP "OFF BALANCE SHEET Product Type 2";
  define product / group "OFF/BALANCE/SHEET/Product"
         style(header)={just=c cellwidth=2in}
         style(column)={just=r};
  define actual / sum "OFF BALANCE SHEET Actual"
         style(header)={cellwidth=2in};
  define predict / sum "OFF BALANCE SHEET Predict"
         style(header)={cellwidth=1in};
run;
             
ods _all_ close;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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