Hello, I have PDF that is generated and produces several tables using proc tabulate that look simliar to the graphic below. I am trying to get a border to appear between the last 2 rows (2016 & Total), however I cannot get this work. I have tried adding the style directly to the 'all' portion of the tabulate, but it does not work. I am thinking there is a setting in my template that is preventing it. Any assistance or pointing the in right direction is much appreciated.
Current Output:
Here is my template code:
PROC TEMPLATE; DEFINE STYLE HighSchoolRTF; PARENT=styles.rtf; replace fonts / 'TitleFont' = ("Arial",12pt,Bold) /* TITLE statement */ 'TitleFont2' = ("Arial",10pt,Bold) /* PROC titles */ 'headingFont' = ("Arial",10pt) /* Table column/row headings */ 'docFont' = ("Arial",10pt) /* data in table cells */ 'footFont' = ("Arial",8pt) /* FOOTNOTE statements */ 'StrongFont' = ("Arial",10pt,Bold) 'EmphasisFont' = ("Arial",10pt,Italic) 'headingEmphasisFont'= ("Arial",10pt,Italic) 'FixedFont' = ("Arial",10pt) 'FixedEmphasisFont' = ("Arial",10pt,Italic) 'FixedStrongFont' = ("Arial",10pt,Bold) 'FixedHeadingFont' = ("Arial",10pt) 'BatchFixedFont' = ("Arial",10pt) ; style table from table / background=_UNDEF_ /* REMOVES TABLE BACKGROUND COLOR */ rules=groups /* INTERNAL BORDERS: SET TO BOTTOM BORDER ON ROW HEADERS */ frame=above /* EXTERNAL BORDERS: SET TO TOP LINE OF TABLE ONLY */ cellspacing=0 /* SPACE BETWEEN TABLE CELLS */ cellpadding=1 /* REMOVES PARAGRAPH SPACING BEFORE/AFTER CELL CONTENTS */ borderwidth=1pt; /* SET WIDTH OF BORDER IN FRAME= */ style headerrow from data / backgroundcolor=grayaa; replace HeadersAndFooters from Cell / background = _undef_ font = Fonts('headingFont') ; replace SystemFooter from TitlesAndFooters / font = Fonts('footFont') just = LEFT ; replace Body from Document / bottommargin = .5in topmargin = .5in rightmargin = .5in leftmargin = .5in ; /*replace usertext from usertext / font = Fonts('StrongFont') just = LEFT;*/ end ; /* END OF DEFINE STYLE MyStyleRTF */ run ; /* END OF PROC TEMPLATE */
Here is my tabulate code:
PROC TABULATE DATA=WORK.GRADUATES; WHERE SCHOOL = "&SCHOOL" AND yearofHSGraduation IN(&YEAR.,&PYEAR.,&PYEAR2.); VAR TOTAL; CLASS SEX / ORDER=UNFORMATTED MISSING; CLASS yearofHSGraduation / ORDER=UNFORMATTED MISSING; CLASS SCHOOL / ORDER=UNFORMATTED MISSING; TABLE /* ROW Statement */ yearofHSGraduation={LABEL=""} all={label='3 Year Total'/*s=[bordertopcolor=black bordertopwidth=1px]}*[style=[bordertopcolor=black bordertopwidth=1px]]*/}, /* COLUMN Statement */ SEX={LABEL=""}*[S=[CELLWIDTH=.75IN JUST=C]] *(TOTAL={LABEL=""} * N={LABEL="#"} TOTAL={LABEL=""} * RowPctN={LABEL="%"}*f=PCTFMT.) all = 'Total'*[S=[CELLWIDTH=.75IN JUST=C]] *(TOTAL={LABEL=""} * N={LABEL="#"} TOTAL={LABEL=""} * RowPctN={LABEL="%"}*f=PCTFMT. ) ;; FORMAT SEX $SEX.; RUN; RUN; QUIT;
Sorry, where exactly are you trying to have the line drawn? Between the 2016 and 3 year total?
Yes, between 2016 & Total, sorry! I just corrected my post to reflect that.
Without data it is hard to test specifics but I would strongly suggest not using PX for a unit as it is display dependant. I am not at all sure how PDF might render PX when pixels are much more of a monitor/display driver related measure.
Try
bordertopwidth=1pt
instead.
This works for the cell directly above the total row header ('3 Year Total') but not the rest of the row.
1) Provide some data or use one of the standard SAS supplied data sets so we have something to test code with.
2) Post the exact code you used. In this example the overline appears over all of the statistics requested and row header:
proc tabulate data=sashelp.class style=styles.rtf; class sex; var height; table sex all*{s=[ bordertopcolor=black bordertopwidth=1pt] }, height * (max min mean) ; keyword all/ style=[bordertopcolor=black bordertopwidth=1pt]; run;
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.