The SAS Output Delivery System and reporting techniques

Using PDF ODS Layout in SAS 9.1.3

Posts: 22

Using PDF ODS Layout in SAS 9.1.3

I am trying to replace a complex EXCEL report by producing the report using ODS PDF. We are using SAS 9.1.3 which means we have less functionality available than in SAS 9.2. The report I am trying to make has a range of tables & graphs in different positions on the page. I have worked out how to do quite a lot using ODS Layout, but I have some problems.

(1) Is there a way to control the individual borders for a cell? For example, I would like most of the borders on in one table, but the top left cell I want its top & left borders off.

(2) Is there a way to merge cells? In EXCEL I can make a table and then perhaps merge 2 of the cells - this is what I want to do.

(3) Is there a way to fit text to a cell of fixed size? Another thing that can be done in EXCEL that I would like to reproduce so that when a cell has very long text it will still fit.

I had also tried using ODS data step objects, but these are a bit limited in 9.1.3 too. I would really appreciate some help or to know whether this is just not possible in 9.1.3. If we can do this in SAS with ODS then we think we can speed up transactions in a web application which produces output in EXCEL using vbScript.

Phil Mason
Posts: 8,742

Re: Using PDF ODS Layout in SAS 9.1.3

Hi, Phil:
You might want to check with Tech Support for the definitive answer, but my take on your questions is:

1) individual borders -- this was an enhancement for SAS 9.2 -- there are now borderleftmargin, borderleftstyle, borderleftwidth and borderleftcolor attributes (and also for top, bottom, right) that have an impact on output. I remember that they work all work, but work slightly differently for RTF, PDF and HTML. I believe that some individual border control was possible with HTML using CSS style properties and with RTF using RTF control strings in 9.1.3 -- nothing for PDF, however.

2) Not sure WHAT cells you want to merge. Again, in 9.2, with PROC REPORT, row spanning is possible with the SPANROWS option. but if, for example, you had SASHELP.CLASS and wanted to merge the column for NAME with the column for AGE, then you would have to concatenate the 2 values together in a data step program prior to using the values on your report. There is no equivalent to merging 2 columns that I know of.

3) When you say "fit text to a cell of a fixed size", it sounds to me like you want to wrap text in a cell. I can do this easily using the cellwidth option in PDF -- you get wrapping for free. See the example below.

I don't use the DATA step object very much these days because it is still being enhanced and could change between now and when it becomes production. I wouldn't expect that it would be productive. However, these papers do have some good info on using ODS LAYOUT and I believe that at least one of them was using SAS and 9.1.3:

Without seeing what you are actually trying to produce, it is hard to comment on whether it's possible with 9.1.3 -- you might want to check with Tech Support to get some determination on the question.

title; footnote;
options linesize=180;
data testit;
length nameage $20;
set sashelp.class;
charvar = 'Twas brillig and the slithy toves did gyre and gimble in the wabe.';
charvar2 = 'All mimsy were the borogroves and the mome raths outgrabe.';
charvar3='Beware the Jabberwock, my son!~nThe jaws that bite, the claws that snatch.';
nameage = catx('~~',name,put(age,2.0));

ods listing;
ods html file='c:\temp\wrap.html' style=egdefault;
ods rtf file='c:\temp\wrap.rtf';
ods pdf file='c:\temp\wrap2.pdf';
ods escapechar='~';
** note that charvar3 has an explicit line feed for
RTF, PDF and HTML: ~n;

proc print data=testit;
title 'Proc Print';
title2 ' LISTING will not use cellwidth; format of $20 will truncate value';
where age gt 14;
var charvar / style(data)={cellwidth=1in};
var charvar2 charvar3 name age nameage;
format charvar2 $20.;

proc report data=testit nowd;
where age gt 14;
title 'Proc Report';
title2 'Listing will use FLOW, other Destinations will use cellwidth';
column ("Note wrapping" charvar charvar2 charvar3) ("Note NAMEAGE var" name age nameage);
define charvar / style(column)={cellwidth=1in};
define charvar2/ flow width=20;
define charvar3 / display;
define name/ display;
ods _all_ close;
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation