The SAS Output Delivery System and reporting techniques

Controlling borders using proc report and ODS

Reply
Occasional Contributor
Posts: 6

Controlling borders using proc report and ODS

Hi,

 

I have seen some similar questions but so far none of the information has helped me.

 

My goal is to be able to toggle borders on/off for different rows of my table. Another way of describing this is that I want a table with borders, followed by a section of text not surrounded by borders directly below, followed by another table with borders and so on.

 

I have tried this code in my proc report but it seems that it has an effect on the output in SAS but not the RTF/PDF file:

 

compute order2;
      if order2 = 3 then do;
           call define(_row_, "style", "style=[backgroundcolor=yellow borderwidth = 0 ]");
      end;
endcomp;

 

The backgroundcolor option had an effect on the ODS output but not the borderwidth option. However, I would ideally like to be able to do something like the code above and turn borders on/off for specific rows according to the value of order2.

 

The only other idea I have is to do have multiple proc reports on a single page and then turn borders on/off entirely for each proc report, however I would like to avoid this as I would have to do maybe 10+ proc reports which is just too messy.

 

I am using SAS 9.4 and either an RTF or PDF output is fine.

 

I hope someone knows of a relatively simple solution.

 

Thanks!

 

 

Grand Advisor
Posts: 9,748

Re: Controlling borders using proc report and ODS

When dealing with color sometimes the issue is the ODS Style in effect. So that may have an effect.

 

You can use style overrides for cell borders but when dealing with row division the issue may be that while you do not draw a top or bottom border (or use a border width of 0) for a cell the one above or below is likely to have a bottom/top that appears as if the cell you are addressing has the border. So of appropriate other rows you may need to set the borderbottomwidth or bordertopwidth to 0, and the left or right borders to adjacent cells on the same border.

 

It may be easier to use an ods style with minimal borders, such as Journal, and turn them on conditionally.

SAS Super FREQ
Posts: 8,645

Re: Controlling borders using proc report and ODS

Hi, what you want doesn't sound like 1 table, it sounds like multiple tables with inserted text between the tables. I can't visualize what your COMPUTE block is doing or supposed to be doing. Without a LINE statement, how are you writing any text?? With PROC REPORT, a table is a table with the same number of columns on every row. The output from a LINE statement spans the entire table. Can you post an actual example of what you hope to get and post the actual code (all the code) you've tried and a sample of some fake data??
cynthia
Occasional Contributor
Posts: 6

Re: Controlling borders using proc report and ODS

options orientation = landscape ;
ods escapechar='^';

ods listing close; ods pdf file="\QCDRAFT1.pdf" style=pdf author="&sysuserid"; proc report data=deliv_info nowindows missing split='|' style(column) = {vjust=b}; column order order2 ("Deliverable Package Information " col1 col2) ; define order / order order = internal noprint; define order2 / order order = internal noprint; define col1 / display style(header)={just=l}"" style(column)={just=l cellwidth=18%}; define col2 / display style(header)={just=l}"" style(column)={just=l cellwidth=76%}; compute after order; line " "; endcomp; compute order2; if order2 = 8 then do; call define(_row_, "style", "style=[backgroundcolor=yellow borderwidth = 0 ]"); end; endcomp; run; ods pdf close; ods listing;

Sorry for the lack of information, hope this helps. There is an attached picture which shows my data, not sure if this is the best way to show you but I don't know of another way. There's nothing confidential in there so it's fine.

 

What I want could be described as multiple tables with text in between, but I wanted to try and avoid multiple proc reports.

 

The first compute block is to place a blank line between values of order, and the second is just something I saw on a forum which allows you to control style options according to the values of a variable (order2) - this works for colour but not for border width.

 

So what I want is:

 

Borders where order2 = 1-5

 

No borders where order2 = 8 

 

Borders where order2 = 9-10

 

No borders where order2 = 14

 

Borders where order2 = 15-16

 

Also I need the line inserted by the first compute block to not be surrounded by borders, like you said this is sort of multiple tables on one page, but if I could contol borders I could do it with one proc report. If this is impossible then please let me know!

 

Thanks,

 

André

Attachment
SAS Super FREQ
Posts: 8,645

Re: Controlling borders using proc report and ODS

Hi:
Personally, this looks like a question you should ask of Tech Support when they can look at your real data or partial data and keep it confidential and help you figure out whether what you want to do can be done.

To me, even though I don't understand your data, since what you show really looks like "top of page" stuff or title page stuff, and not really a table. I just don't think you can turn the borders on and off the way you want/need with 1 PROC REPORT step. Really a question for Tech Support.

cynthia
Post a Question
Discussion Stats
  • 4 replies
  • 772 views
  • 0 likes
  • 3 in conversation