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
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).
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.
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
You need PROC REPORT statement option SPANROWS.
Hi:
Is this what you need to produce?
Cynthia
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.
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.
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:
(All output ODS RTF -- same code as in previous screen shot with only style(report) overrides changed as shown.)
Cynthia
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?
Much Appreciation.
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 Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.