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

Using the SASHELP.Class data set as an example.  

I have the following Code.  

 ods rtf file="C:\FilePath\TestRTF.rtf";
options nodate nonumber;
Title "Summary";

proc report data=SASHELP.Class
Style(Report) = [Frame=Below];
Column Sex Name Age Height Weight;
Define Sex / Group Center;
Define Name / Style(Column)=[CellWidth=0.75in] CENTER;
Define Age / Style(Column)=[CellWidth=0.75in] CENTER;
Define Height / Style(Column)=[CellWidth=0.75in] CENTER;
Define Weight / Style(Column)=[CellWidth=0.75in] CENTER;
run;
ods rtf close;


This outputs the following

mcook_1-1633465920056.png

How do I Remove the Row lines in the sex Column(Except the line separating F from M of course), and Vertically Center the F and M? 

as in the 'Usage' and 'Attributes' Rows in this table below (Ironically from a paper on how to use proc report).

 

mcook_2-1633466331113.png

 

Also.  Is it possible to remove only certain vertical lines?  For example.  Remove the Vertical Lines separating 'Name' from 'Age', and 'Age' from 'Height'.  While leaving the rest?

 

Any help appreciated.  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Remember that a cell has borders on ALL sides. So if you are going to change one border to be black, then you've got to change the other border to be the same as the background color (in this case, the color GRAYBB, which is the same as CXBBBBBB. This worked for me:

Cynthia_sas_0-1633564777434.png

Cynthia

View solution in original post

16 REPLIES 16
data_null__
Jade | Level 19

You need PROC REPORT statement option SPANROWS.

Reeza
Super User
Line colours, width and spacing is controlled with the STYLE options.

Cynthia_sas
SAS Super FREQ

Hi:

  Is this what you need to produce?

Cynthia_sas_0-1633476818410.png

 

Cynthia

mcook
Quartz | Level 8
I was able to remove specified vertical lines with borderleftcolor=white and borderrightcolor=white. But this leaves a small gap in the horizontal row lines, where the vertical line is now white.. I tried to put in borderbottomcolor=black to compensate, but it does not. Are those the style options you were referring to?
ballardw
Super User

As @data_null__ says SPANROWS to get the group variables in a single "cell". Style with Vjust (vertical justification) to center.

To remove one side of cell border you can set adjacent border widths to zero (need both as each cell draws its own border). If you want the border removed between the column headings you would remove the (column) part of the Style override, otherwise the Name and Age headers in the example below will still have the vertical line.

 


proc report data=SASHELP.Class SPANROWS
Style(Report) = [Frame=Below];
Column Sex Name Age Height Weight;
Define Sex / Group Center style=[Vjust=center] ;
Define Name / Style(Column)=[CellWidth=0.75in borderrightwidth=0] CENTER;
Define Age / Style(Column)=[CellWidth=0.75in borderleftwidth=0] CENTER ;
Define Height / Style(Column)=[CellWidth=0.75in] CENTER;
Define Weight / Style(Column)=[CellWidth=0.75in] CENTER;
run;

This will make any group variable span the rows though. So if you have multiple Group variables this might not be what you want.

mcook
Quartz | Level 8
I added your borderrightwidth and borderleftwidth=0 , but it does not get rid of the lines.
also tried borderrightwidth and borderleftwidth = 0pt. Still no change.
mcook
Quartz | Level 8

from https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsproc/p1pt77toue3iyun0z4l9gth5as9f.htm

 

BorderLeftWidth=Dimension

     specifies the width of the left border of the table or cell.

 

And Dimension is a whole number, a percentage, or nonnegative number followed by unit of measure

 

So Borderleftwidth=0  is not a valid dimension.  

 

mcook
Quartz | Level 8
oh wait. i read non negative as non zero. My fault.

I agree that borderleftwidth=0pt, or 0in, etc.. should work.
Cynthia_sas
SAS Super FREQ

Hi:

  Before you start playing with bordercolor and border width, I recommend experimenting with RULES, FRAME and CELLSPACING to see if that provides the look you want:

Cynthia_sas_0-1633531261352.png

 

(All output ODS RTF -- same code as in previous screen shot with only style(report) overrides changed as shown.)

 

Cynthia

mcook
Quartz | Level 8
All of those seem to get rid of all interior lines. I only want to remove certain ones.
Cynthia_sas
SAS Super FREQ
Hi:
You're right. All of those get rid of interior lines because of the RULES=NONE override. There are other possible values for the RULES attribute. You can have RULES=NONE, as I show,. Also, RULES=ALL (the default), RULES=ROWS, RULES=COLS, and RULES=GROUPS. Those can be combined with the possible values for FRAME= to customize the look. Then, if none of those combinations can work for you, you can experiment with bordercolor and borderwidth.
Cynthia
mcook
Quartz | Level 8

Using Rules=Rows to to give me just the rows, and adding in manually all the vertical ones I want does get me closer to what i am looking for.  However not quite.  it leaves white spaces in the header where the missing vertical lines would go.  

 

here is my current code 

ods rtf file="FilesPath\TestRTF.rtf";
options nodate nonumber;

proc report data=SASHELP.Class spanrows

Style(Report) = [Rules=Rows Frame=HSides 
					pretext='Table1.1 Temp Title' Just=left
					font=('Times New Roman', 12pt, bold)];

Column Sex Name Age Height Weight;
Define Sex / Group Center style(column)=[Vjust=Center];
Define Name / style=[borderleftwidth=1pt] CENTER;
Define Age /  style=[borderrightwidth=1pt] CENTER ;
Define Height / Style(Column)=[CellWidth=0.75in] CENTER;
Define Weight / Style(Column)=[CellWidth=0.75in] CENTER;
run;
ods rtf close;

This outputs the below table.  How do remove the white vertical bars between name|age and height|weight?  

 

mcook_0-1633551281501.png

 

Much Appreciation.  

Reeza
Super User
Do you need to apply those to the HEADER as well as the REPORT?
Ie Style(HEADER) = .....
Cynthia_sas
SAS Super FREQ

Hi:

  Remember that a cell has borders on ALL sides. So if you are going to change one border to be black, then you've got to change the other border to be the same as the background color (in this case, the color GRAYBB, which is the same as CXBBBBBB. This worked for me:

Cynthia_sas_0-1633564777434.png

Cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 16 replies
  • 1947 views
  • 8 likes
  • 5 in conversation