BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I want to put a thick border around my tables in Proc Report, output via ExcelXP but am having trouble applying it to my table.

I have set up a style in my template:

style rep_border from table / borderrightstyle=solid borderrightwidth=2 borderrightcolor=black
borderleftstyle=solid borderleftwidth=2 borderleftcolor=black
borderbottomstyle=solid borderbottomwidth=2 borderbottomcolor=black
bordertopstyle=solid bordertopwidth=2 bordertopcolor=black;


and am trying to apply it in Proc Report as an option on the proc report line using the following code:

style(report)=rep_border

I cannot find any documentation telling me if my options are correct. Any help would be appreciated. Thanks in advance.

Drew
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
You do seem to be using the correct reference method.

I wonder if this is one of those cases where if you sent your output to HTML, it would look as you expect; but Excel doesn't use the border style the same way that HTML does????

Perhaps you could try this:
[pre]
** style template code;

ods html file='ht_test.html' style=newstyle;
ods tagsets.excelxp file='xp_test.xml' style=newstyle;
** proc report code;
ods _all_ close;
[/pre]

If the HTML output looks as you expect, but the Excel does NOT look as you expect, then this is not an issue with PROC REPORT, it is an issue with Excel not rendering the table settings correctly, or else the table border settings are being overridded by the cell-level settings. This probably turns your question into a question for Tech Support, whether they know of a way to have the table borders set via a style template when using TAGSETS.EXCELXP.

cynthia
deleted_user
Not applicable
Thanks Cynthia

I should probably explain further: I have used the following successfully to put a thick border around my headers.

style head_border from header / borderrightstyle=solid borderrightwidth=2 borderrightcolor=black
borderleftstyle=solid borderleftwidth=2 borderleftcolor=black
borderbottomstyle=solid borderbottomwidth=2 borderbottomcolor=black
bordertopstyle=solid bordertopwidth=2 bordertopcolor=black
just=c;


and then called it with this:
style(header)=head_border

which leads me to suspect that I am not using the correct references for the table/report either in the Template or the option in Proc Report.

Thanks.
Cynthia_sas
SAS Super FREQ
Hi:
I understand, however, Header borders are CELL-level borders. You are trying to change TABLE-level borders. Just because you can change CELL-level borders in the ExcelXP destination, does not mean that Excel will correctly render TABLE-level borders.

I think it's worthwhile to test whether ODS HTML respects your TABLE level borders as a problem-solving/debugging technique. If ODS HTML shows the TABLE-level borders, but Excel does not, then the problem is NOT with SAS or PROC REPORT. This is useful information.

For example, when I try this code which has RED TABLE-level borders and YELLOW CELL-level borders, I see RED and YELLOW in the HTML output, but I only see YELLOW in the ExcelXP output. This leads me to believe that the issue is with Excel. Sending the information via PROC REPORT overrides in this instance would be the same as sending style info to Excel via a style template.

I don't know whether there's a way to change TABLE-level borders in Excel. This may be a question for Tech Support.

cynthia
[pre]
ods html file='c:\temp\test_border.html' style=styles.sasweb;
ods tagsets.excelxp file='c:\temp\test_border.xml'
style=styles.sasweb;
proc report data=sashelp.class(obs=3) nowd
style(report)={borderrightstyle=solid borderrightwidth=5 borderrightcolor=red
borderleftstyle=solid borderleftwidth=5 borderleftcolor=red
borderbottomstyle=solid borderbottomwidth=5 borderbottomcolor=red
bordertopstyle=solid bordertopwidth=5 bordertopcolor=red}
style(header)={borderrightstyle=solid borderrightwidth=5 borderrightcolor=yellow
borderleftstyle=solid borderleftwidth=5 borderleftcolor=yellow
borderbottomstyle=solid borderbottomwidth=5 borderbottomcolor=yellow
bordertopstyle=solid bordertopwidth=5 bordertopcolor=yellow};
column name age height;
run;
ods _all_ close;

[/pre]
deleted_user
Not applicable
Thanks Cynthia, Excel is a nightmare as ever... Message was edited by: ScoobyDrew

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 903 views
  • 0 likes
  • 2 in conversation