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

Hi,

 

The SAS online documentation gave me the impression that it would be possible to use multiple values in the borderstyle attribute

borderstyle.JPG

https://documentation.sas.com/doc/en/pgmsascdc/v_017/odsug/p1pt77toue3iyun0z4l9gth5as9f.htm#p0kyb7yj...

 

However, the following code doesn't work:

 

ods excel file="&xxtest./reporting/test.xlsx"
          options(start_at='2,2');

proc print data=sashelp.class noobs
           style(header)=[borderstyle=none double solid none] 
           style(column)=[bordertopstyle   =none
                          borderrightstyle =double
                          borderbottomstyle=solid
                          borderleftstyle  =none];
run;

ods excel close;

Any idea about the right syntax?

1 ACCEPTED SOLUTION

Accepted Solutions
xxformat_com
Barite | Level 11

@Ksharp 

In the SAS online documentation they don't use border-style but borderstyle without hyphen.

But beside that I've managed to find a possible explaination: border-style followed by multiple values is possible in CSS.

 

ods excel file="&xxtext/test.xlsx"
          options(start_at='2,2') 
          cssstyle="&xxtext./test.css";*;

proc print data=sashelp.class noobs;
run;

ods excel close;

test.css

.header, .rowheader {background-color:yellow;border-style=none double solid none;}
.data {background-color:pink;border-style=none double solid none;}

 

 

View solution in original post

7 REPLIES 7
Ksharp
Super User

You want this ?

 

ods excel file="c:\temp\test.xlsx"
          options(start_at='2,2');

proc print data=sashelp.class noobs
           style(header)=[borderstyle=none ] 
           style(column)=[bordertopstyle   =none
                          borderrightstyle =double borderrightwidth =2
                          borderbottomstyle=solid  borderbottomwidth=2
                          borderleftstyle  =none];
run;

ods excel close;

Ksharp_0-1640009684257.png

 

xxformat_com
Barite | Level 11

Hi, 

Here the question is: how to get more than one value for borderstyle as it seems possible according to the SAS online doc.

xxformat_com
Barite | Level 11

@Ksharp 

In the SAS online documentation they don't use border-style but borderstyle without hyphen.

But beside that I've managed to find a possible explaination: border-style followed by multiple values is possible in CSS.

 

ods excel file="&xxtext/test.xlsx"
          options(start_at='2,2') 
          cssstyle="&xxtext./test.css";*;

proc print data=sashelp.class noobs;
run;

ods excel close;

test.css

.header, .rowheader {background-color:yellow;border-style=none double solid none;}
.data {background-color:pink;border-style=none double solid none;}

 

 

Cynthia_sas
SAS Super FREQ

Hi:
In my experience, borderstyle options are honored best in PDF and RTF destinations. Sometimes, HTML output will respect multiple borderstyles. I generally control using the left/right/top/bottom version of the style override instead of pumping them into one borderstyle attribute override. However, ODS EXCEL is difficult. Also, remember that bottom border for one cell "bumps into" or is adjacent to the top border for the cell underneath it. Same thing with left/right. The right side border for one cell is adjacent to the left border of the cell next to it. For example, 2 completely different "looks" for the same code:

Cynthia_sas_0-1640190127885.png


So frequently, you do not get the look you want in any destination. Whether you can do what you want with multiple attributes in one override may turn out to need more investigation in the doc or with Tech Support.
Cynthia

xxformat_com
Barite | Level 11
It's really strange. The issue seems to come from the Excel destination only.
If you use a different borderstyle for the bottom and the top, then the colors are the same as in the HTML destination.

*ISSUE;
ods excel file="&xxtraining./reporting/ods_excel_test1.xlsx"
options(start_at='2,2' sheet_interval='none');

proc print data=sashelp.class noobs
style(column)=[bordertopstyle=solid bordertopcolor=blue
borderbottomstyle=solid borderbottomcolor=red];
run;

ods excel close;

*OK;
ods excel file="&xxtraining./reporting/ods_excel_test2.xlsx"
options(start_at='2,2' sheet_interval='none');

proc print data=sashelp.class noobs
style(column)=[bordertopstyle=solid bordertopcolor=blue
borderbottomstyle=double borderbottomcolor=red];
run;

ods excel close;
Cynthia_sas
SAS Super FREQ
Hi:
I generally find that the Excel destination can be a little wonky with borders and styles, so I tend to avoid them because it takes too much fiddling and I'm never completely happy with what I get. So I've learned to change my expectations as far as ODS EXCEL output and the rendering that Microsoft does with the xlsx file created by ODS.
Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 7 replies
  • 675 views
  • 1 like
  • 3 in conversation