<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Weird interaction between Proc Report, ODS EXCEL, and cell borders in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590169#M23299</link>
    <description>&lt;P&gt;So I'm seeing something odd when trying to play with cell borders in a proc report going to an ODS EXCEL output. The client is requesting that some of the cells be merged horizontally--as far as I can tell, I can't do that via SAS, but I figured I could try and fake it with 0-width internal cell borders. This seems to work fine in the internal results viewer, but when transitioned to Excel, any cell with any border attribute defined instead gets completely surrounded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS EG results viewer:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS results.png" style="width: 203px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32621iB2A1ADE6E196D285/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAS results.png" alt="SAS results.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excel output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Excel results.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32622i7BA07231F30DA719/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel results.png" alt="Excel results.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired Excel Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Excel ideal.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32631i5806C832BE42BBF4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel ideal.png" alt="Excel ideal.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="&amp;amp;PDFPath./&amp;amp;&amp;amp;filename_value._&amp;amp;&amp;amp;qvar..xlsx" style=journal&lt;BR /&gt;options(embedded_titles='yes' embedded_footnotes='yes' sheet_interval='NONE' sheet_name="&amp;amp;qtrvar. Summary"&lt;BR /&gt;absolute_column_width='26,12,26,12' );&lt;BR /&gt;&lt;BR /&gt;proc report data=source spanrows nowd
	style(header)={bordertopwidth=.5 borderbottomwidth=.5
		borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
		bordercolor=black};
	column ("Level 2" (row1 value1 row2 value2));
	define row2 / " " style(column)={width=1000%};
	define row1 / " " style(column)={width=1000% bordertopwidth=.5 borderbottomwidth=.5
						borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
						bordercolor=black};
	define value1 / " " style(column)={width=1000% bordertopwidth=.5 borderbottomwidth=.5
						borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
						bordercolor=black};
	define value2 / " " style(column)={width=1000% bordertopwidth=0 borderbottomwidth=0
						borderleftwidth=0 borderrightwidth=.5 borderstyle=solid
						bordercolor=black};

	compute value1;
	if row1 = 'Target Achieved: Y' then do;
		call define('row1', 'style', 'style=[background=lightgreen font_weight=bold just=c]');
		call define('value1', 'style', 'style=[background=lightgreen font_weight=bold just=c]');
		call define('row2', 'style', 'style=[borderbottomwidth=.5]');
		call define('value2', 'style', 'style=[borderbottomwidth=.5]');
	end;
	else if row1 = 'Target Achieved: N' then do;
		call define('row1', 'style', 'style=[background=lightred font_weight=bold just=c]');
		call define('value1', 'style', 'style=[background=lightred font_weight=bold just=c]');
		call define('row2', 'style', 'style=[borderbottomwidth=.5]');
		call define('value2', 'style', 'style=[borderbottomwidth=.5]');
	end;
	endcomp;
quit;&lt;BR /&gt;&lt;BR /&gt;ods&amp;nbsp;excel&amp;nbsp;close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 23:14:52 GMT</pubDate>
    <dc:creator>scify</dc:creator>
    <dc:date>2019-09-19T23:14:52Z</dc:date>
    <item>
      <title>Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590169#M23299</link>
      <description>&lt;P&gt;So I'm seeing something odd when trying to play with cell borders in a proc report going to an ODS EXCEL output. The client is requesting that some of the cells be merged horizontally--as far as I can tell, I can't do that via SAS, but I figured I could try and fake it with 0-width internal cell borders. This seems to work fine in the internal results viewer, but when transitioned to Excel, any cell with any border attribute defined instead gets completely surrounded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS EG results viewer:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS results.png" style="width: 203px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32621iB2A1ADE6E196D285/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAS results.png" alt="SAS results.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excel output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Excel results.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32622i7BA07231F30DA719/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel results.png" alt="Excel results.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired Excel Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Excel ideal.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32631i5806C832BE42BBF4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel ideal.png" alt="Excel ideal.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="&amp;amp;PDFPath./&amp;amp;&amp;amp;filename_value._&amp;amp;&amp;amp;qvar..xlsx" style=journal&lt;BR /&gt;options(embedded_titles='yes' embedded_footnotes='yes' sheet_interval='NONE' sheet_name="&amp;amp;qtrvar. Summary"&lt;BR /&gt;absolute_column_width='26,12,26,12' );&lt;BR /&gt;&lt;BR /&gt;proc report data=source spanrows nowd
	style(header)={bordertopwidth=.5 borderbottomwidth=.5
		borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
		bordercolor=black};
	column ("Level 2" (row1 value1 row2 value2));
	define row2 / " " style(column)={width=1000%};
	define row1 / " " style(column)={width=1000% bordertopwidth=.5 borderbottomwidth=.5
						borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
						bordercolor=black};
	define value1 / " " style(column)={width=1000% bordertopwidth=.5 borderbottomwidth=.5
						borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
						bordercolor=black};
	define value2 / " " style(column)={width=1000% bordertopwidth=0 borderbottomwidth=0
						borderleftwidth=0 borderrightwidth=.5 borderstyle=solid
						bordercolor=black};

	compute value1;
	if row1 = 'Target Achieved: Y' then do;
		call define('row1', 'style', 'style=[background=lightgreen font_weight=bold just=c]');
		call define('value1', 'style', 'style=[background=lightgreen font_weight=bold just=c]');
		call define('row2', 'style', 'style=[borderbottomwidth=.5]');
		call define('value2', 'style', 'style=[borderbottomwidth=.5]');
	end;
	else if row1 = 'Target Achieved: N' then do;
		call define('row1', 'style', 'style=[background=lightred font_weight=bold just=c]');
		call define('value1', 'style', 'style=[background=lightred font_weight=bold just=c]');
		call define('row2', 'style', 'style=[borderbottomwidth=.5]');
		call define('value2', 'style', 'style=[borderbottomwidth=.5]');
	end;
	endcomp;
quit;&lt;BR /&gt;&lt;BR /&gt;ods&amp;nbsp;excel&amp;nbsp;close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 23:14:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590169#M23299</guid>
      <dc:creator>scify</dc:creator>
      <dc:date>2019-09-19T23:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590178#M23302</link>
      <description>Why is your width set to 1000% and not 100%?What does the log show?</description>
      <pubDate>Thu, 19 Sep 2019 20:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590178#M23302</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-19T20:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590181#M23303</link>
      <description>&lt;P&gt;The width is set to 1000 because I based the code off of another proc report in some code I inherited. The log doesn't show anything useful, unfortunately--no errors, no warnings, only the note telling me that the excel file was written to the output file.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590181#M23303</guid>
      <dc:creator>scify</dc:creator>
      <dc:date>2019-09-19T20:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590194#M23305</link>
      <description>&lt;P&gt;With Excel output you should also show your ODS Excel definition, or Tagsets.Excel , or describe how you get the output to Excel.&lt;/P&gt;
&lt;P&gt;There are options that may help with cell width as the body of a report procedure's output may well be controlled by the output from a previous procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which way are you attempting to mimic merging? It appears that you might be doing a top/bottom merge?&lt;/P&gt;
&lt;P&gt;On a row where you have a borderleftwidth=0 the column to the left would also want a borderrightwidth=0 to suppress that border&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would also help to either provide data or provide an example of what you are attempting with one of the SAS supplied data sets like SASHELP.CLASS.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590194#M23305</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-19T20:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590214#M23306</link>
      <description>Doesn't that strike you as incorrect?</description>
      <pubDate>Thu, 19 Sep 2019 21:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590214#M23306</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-19T21:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590228#M23307</link>
      <description>&lt;P&gt;Cell width is not the issue here. It's just something Reeza caught on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The hypothetical merge would be horizontal, across the first two columns of the bottom row. Every answer I've seen about doing that says it can't be done, which is why I'm trying to fake it with hidden cell borders.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you look at the example images I posted above, you can see that the borders are coming out correctly in the SAS results viewer, but not when it is exported to excel. You are correct that I forgot to put the ods statement in, which I meant to; I'll go ahead and edit that back in to the original post now, as well as an example of what I'm actually trying to get the Excel to look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There isn't really much in the way of underlying data here; because I'm trying to reproduce what the client mocked up in Excel, it's literally just text pushed through a proc stream to an infile that will eventually have values (in the column value1) filled in with macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The main thing I'm trying to figure out here is why the borders are behaving differently in the Excel export: for whatever reason the rightmost column (the variable value2), which only has a right border in the results viewer, suddenly has a full border in Excel.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 22:42:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590228#M23307</guid>
      <dc:creator>scify</dc:creator>
      <dc:date>2019-09-19T22:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590231#M23308</link>
      <description>What version of SAS are you using? Can you generate similar code using SASHELP so we can test it? As posted we can't run your code to test anything. &lt;BR /&gt;&lt;BR /&gt;Prior to SAS 9.4TS1M3 ODS Excel was pre-production and had issues. If you're using an older version that may be the reason. Again, if we can't run your code, it's hard to comment beyond that without generating our own examples, which is time intensive.</description>
      <pubDate>Thu, 19 Sep 2019 22:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590231#M23308</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-19T22:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590236#M23309</link>
      <description>&lt;P&gt;PROC PRODUCT_STATUS tells me it's SAS&amp;nbsp;9.4 M5. I'm accessing it through EG 7.11 HF3, if that matters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data set is created as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let ent_rb = foo;

proc stream outfile=text; begin
Rate: Baseline| &amp;amp;ent_rb| | |
Rate: Current | | | |
Improvement| | | |
Superior Performance| | | |
Target Achieved:| | | |
;;;;



data source;
infile text delimiter="|";
length row1 row2 $150;
input row1 $ value1 $ row2 $ value2 $ @@ ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Sep 2019 23:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590236#M23309</guid>
      <dc:creator>scify</dc:creator>
      <dc:date>2019-09-19T23:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Weird interaction between Proc Report, ODS EXCEL, and cell borders</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590559#M23313</link>
      <description>&lt;P&gt;This gets a little closer:&lt;/P&gt;
&lt;PRE&gt;%let ent_rb = foo;

data work.source;
infile datalines dlm='|';
length row1 row2 $150;
input row1 $ value1 $ row2 $ value2 $  ;
datalines;
Rate: Baseline| &amp;amp;ent_rb| | |
Rate: Current | | | |
Improvement| | | |
Superior Performance| | | |
Target Achieved:| | | |
;
run;

ods excel file="x:\data\junk.xlsx" 
   style=journal options(embedded_titles='yes' 
   embedded_footnotes='yes' sheet_interval='NONE' 
   sheet_name="text. Summary"absolute_column_width='26,12,26,12' );

proc report data=work.source spanrows nowd
	style(header)={bordertopwidth=.5 borderbottomwidth=.5
		borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
		bordercolor=black}
   ;
	column ("Level 2" (row1 value1 row2 value2));
	define row2 / " " style(column)={};
	define row1 / " " style(column)={ bordertopwidth=.5 borderbottomwidth=.5
						borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
						bordercolor=black};
	define value1 / " " style={  borderwidth=0
						borderstyle=solid
						bordercolor=black};
	define value2 / " " style={  borderwidth=0
						};

	compute value1;
	if row1 = 'Target Achieved: Y' then do;
		call define('row1', 'style', 'style=[background=lightgreen font_weight=bold just=c]');
		call define('value1', 'style', 'style=[background=lightgreen font_weight=bold just=c]');
		call define('row2', 'style', 'style=[borderbottomwidth=.5]');
	end;
	else if row1 = 'Target Achieved: N' then do;
		call define('row1', 'style', 'style=[background=lightred font_weight=bold just=c]');
		call define('value1', 'style', 'style=[background=lightred font_weight=bold just=c]');
		call define('row2', 'style', 'style=[borderbottomwidth=.5]');
	end;
	endcomp;
quit;
ods excel close;&lt;/PRE&gt;
&lt;P&gt;To get your "Target Achieved" to span columns as you show in desired is beyond what I can' do at the moment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A big cause of your extra lines was in the compute block for Value1.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 22:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Weird-interaction-between-Proc-Report-ODS-EXCEL-and-cell-borders/m-p/590559#M23313</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-20T22:52:54Z</dc:date>
    </item>
  </channel>
</rss>

