BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jaheuk
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tim_SAS
Barite | Level 11

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

2 REPLIES 2
Tim_SAS
Barite | Level 11

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.

Cynthia_sas
SAS Super FREQ

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 1127 views
  • 0 likes
  • 3 in conversation