BookmarkSubscribeRSS Feed
SuryaKiran
Meteorite | Level 14

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. 

image.png

 

Expected result: Border lines to be 'dotted' in pdf report.

 

Additional details:

Current version: 9.04.01M5P091317

Operating System: LIN X64

 

 

 

 

Thanks,
Suryakiran
5 REPLIES 5
ballardw
Super User

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.

 

SuryaKiran
Meteorite | Level 14

@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. 

Thanks,
Suryakiran
ballardw
Super User

@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.

 

 

Cynthia_sas
SAS Super FREQ
Hi:
PDF is a proprietary type of file, defined by Adobe and designed to be opened with Adobe products. (Although there are 3rd party products that will open and edit Adobe PDF files). An ODS PDF file is NOT created with a markup language like RTF or HTML. So if there is not a way to convert table lines to dotted in the method we have to use to convert the SAS output to PDF, then that is the reason that borderstyle is not supported.
Originally, in the very beginning of ODS, there was only ODS PRINTER -- which was how you sent your output from SAS directly to a printer. Next, there was ODS POSTSCRIPT, which made a .PS file that you could use an Adobe product to "distill" into a PDF format file. Finally, there was ODS PDF, which creates an Adobe binary format file according to the Adobe proprietary specification. This group of ODS destinations is known as the "printer-family" of destinations, because their origin long ago, in a galaxy far, far away, was with the ODS PRINTER destination.
Cynthia

xxformat_com
Barite | Level 11

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.

 

printer1.JPG

 

 

printer2.JPG

 

printer3.JPG

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;

printer4.JPG

 

Could proc odstable provides an alternative solution? I haven't investigated it.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1805 views
  • 0 likes
  • 4 in conversation