Hello Community!
I am having issues applying borderstyle for PDF reports.
Template for custom style:
/* Test - 1*/
proc template;
define style mystyle;
notes "My Simple Style";
class table /
backgroundcolor = White
bordercolor = black
borderstyle = dotted
borderwidth = 0.1pt
cellpadding = 5pt
cellspacing = 0pt
frame = box
rules = all
;
end;
run;
ods pdf file="/user/test_report.pdf" style=mystyle nobookmarkgen startpage=no;
proc report data=sashelp.class;
column Name Age Height;
run;
ods pdf close;
/* Test -2 */
ods pdf file="/user/test_report.pdf" nobookmarkgen startpage=no;
proc report data=sashelp.class;
column Name Age Height;
define Name/style(column)=[borderstyle=dotted];
run;
ods pdf close;
Here is the pdf report that produced, but borderstyle is not dooted. Where as if I view the proc report result in html I do get dotted lines. Totally confused and not sure what is happening.
Expected result: Border lines to be 'dotted' in pdf report.
Additional details:
Current version: 9.04.01M5P091317
Operating System: LIN X64
See if this has the dotted lines.
ods rtf file="/user/test_report.rtf" style=mystyle nobookmarkgen startpage=no; proc report data=sashelp.class; column Name Age Height; run; ods rtf close;
You may not be able to do this with PDF.
The documentation from Borderstyle has this note:
The BORDERTOPSTYLE= attribute is valid only in markup family destinations, the RTF destination, and the Measured RTF destination. |
PDF is in the Printer family of ODS destinations.
@ballardw you're right, it is working for RTF and not for PDF. Is there an alternate way to apply for PDF? This limitation made me to switch to R programming to get what I needed.
@SuryaKiran wrote:
@ballardw you're right, it is working for RTF and not for PDF. Is there an alternate way to apply for PDF? This limitation made me to switch to R programming to get what I needed.
Not that I am aware of other than an RTF to PDF converter outside of SAS.
I don't know enough about the inner works of PDF file structures to even guess as to why PDF is treated as a "printer" for ODS purposes but I would guess there is something fundamentally different about how some table characteristics are managed.
I generally do not work with PDF output so have not investigated such features.
Hi,
Your question is nearly two years old but thought it could be interesting for people reading this page.
Here are the possible styles attributes for a table in a PDF file:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/n0otdo2g12obp3n0zmnghcn7p4vu.htm
Only Borderbottomstyle is listed but I don't have any example where it would work.
Having say that, let's have a look at an example using colors instead. To make sure that all lines have the same width, overlapping should be avoiding.
The code is getting heavy. I would rather recommand backgroundcolor attribute to emphasise given cells.
ods pdf file="&xxdemo./test.pdf";
proc print data=sashelp.class noobs
style(report)=[frame=void rules=none];
var name / style(header data)=[bordertopwidth =1px bordertopcolor =black
borderrightwidth =0px
borderbottomwidth=1px borderbottomcolor=black
borderleftwidth =1px borderleftcolor =black];
var age / style(header)=[bordertopwidth =1px bordertopcolor =black
borderrightwidth =1px borderrightcolor =black
borderbottomwidth=1px borderbottomcolor=orange
borderleftwidth =1px borderleftcolor =black]
style(data) =[bordertopwidth =0px
borderrightwidth =1px borderrightcolor =orange
borderbottomwidth=1px borderbottomcolor=orange
borderleftwidth =1px borderleftcolor =orange];
var height / style(header data)=[bordertopwidth =1px bordertopcolor =black
borderrightwidth =1px borderrightcolor =black
borderbottomwidth=1px borderbottomcolor=black
borderleftwidth =0px];
run;
ods pdf close;
Could proc odstable provides an alternative solution? I haven't investigated it.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.