<?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 Specifically Control Background Color of Merged Cells. ODS Excel and Proc Report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Specifically-Control-Background-Color-of-Merged-Cells-ODS-Excel/m-p/773498#M25350</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have used ODS Excel and Proc Report to create an Excel File. And in the 1st image below, I would like columns A, B, C, D of row 1 to be green instead of blue. I would also like column E in row 1 to be blue. I am not sure how to control the colors of the individual columns in the first row. Please can you help? Ideally, I would like the 1st image to look like the 2nd image, which I created in Excel. Below also shows the code that I have used, and I have attached the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS Header.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64594iC4DBC8DA52CA415D/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS Header.PNG" alt="SAS Header.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Excel Header.PNG" style="width: 992px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64593i7E2F1848EE27FC77/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel Header.PNG" alt="Excel Header.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="&amp;amp;export" options(flow="tables" sheet_name="QSORRES Mapping" absolute_column_width = "22, 23, 16, 60, 60, 13, 60, 65");
ods escapechar='~';
proc report data=input_data nowd spanrows wrap style(header)={textalign=left /*fontsize=10pt fontweight=bold*/ /*fontfamily="Albany AMT"*/} style(column)={textalign=left /*fontsize=10pt  *//*fontfamily="Albany AMT"*/};
     column ('~S={foreground=black}Raw'  FORMNAME_TEST FORMNAME_PRODUCTION ITEMNAME VALUE)  
            ('~S={foreground=black}SDTM' QSORRES QSSTRESN QSSTRESC Comments_Special_characters_);
     define FORMNAME_TEST / "FormName Test" display style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define FORMNAME_PRODUCTION / "FormName Production" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define ITEMNAME / "ItemName" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define VALUE / "Value" style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#E2EFDA foreground=black};

     define QSORRES / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=D9E1F2} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESN / format=8. style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESC / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#D9E1F2 foreground=black};
     define Comments_Special_characters_/ "Comments (Special characters)" style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};     
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kriss&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Oct 2021 21:34:36 GMT</pubDate>
    <dc:creator>djrisks</dc:creator>
    <dc:date>2021-10-11T21:34:36Z</dc:date>
    <item>
      <title>Specifically Control Background Color of Merged Cells. ODS Excel and Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Specifically-Control-Background-Color-of-Merged-Cells-ODS-Excel/m-p/773498#M25350</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have used ODS Excel and Proc Report to create an Excel File. And in the 1st image below, I would like columns A, B, C, D of row 1 to be green instead of blue. I would also like column E in row 1 to be blue. I am not sure how to control the colors of the individual columns in the first row. Please can you help? Ideally, I would like the 1st image to look like the 2nd image, which I created in Excel. Below also shows the code that I have used, and I have attached the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS Header.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64594iC4DBC8DA52CA415D/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS Header.PNG" alt="SAS Header.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Excel Header.PNG" style="width: 992px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64593i7E2F1848EE27FC77/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel Header.PNG" alt="Excel Header.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="&amp;amp;export" options(flow="tables" sheet_name="QSORRES Mapping" absolute_column_width = "22, 23, 16, 60, 60, 13, 60, 65");
ods escapechar='~';
proc report data=input_data nowd spanrows wrap style(header)={textalign=left /*fontsize=10pt fontweight=bold*/ /*fontfamily="Albany AMT"*/} style(column)={textalign=left /*fontsize=10pt  *//*fontfamily="Albany AMT"*/};
     column ('~S={foreground=black}Raw'  FORMNAME_TEST FORMNAME_PRODUCTION ITEMNAME VALUE)  
            ('~S={foreground=black}SDTM' QSORRES QSSTRESN QSSTRESC Comments_Special_characters_);
     define FORMNAME_TEST / "FormName Test" display style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define FORMNAME_PRODUCTION / "FormName Production" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define ITEMNAME / "ItemName" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define VALUE / "Value" style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#E2EFDA foreground=black};

     define QSORRES / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=D9E1F2} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESN / format=8. style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESC / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#D9E1F2 foreground=black};
     define Comments_Special_characters_/ "Comments (Special characters)" style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};     
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kriss&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 21:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Specifically-Control-Background-Color-of-Merged-Cells-ODS-Excel/m-p/773498#M25350</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2021-10-11T21:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Specifically Control Background Color of Merged Cells. ODS Excel and Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Specifically-Control-Background-Color-of-Merged-Cells-ODS-Excel/m-p/773564#M25353</link>
      <description>&lt;P&gt;Would you like to try ODS RWI? It gives specific control over which cell should be displayed like what.&lt;/P&gt;
&lt;P&gt;It's object orientated language but more like how we write HTML pages without a CSS file.&lt;/P&gt;
&lt;P&gt;a sample code that can solve your problem looks like this:&lt;/P&gt;
&lt;P&gt;( tweak the code for your dataset names etc., I'm using "work.test" )&lt;/P&gt;
&lt;P&gt;To read more about this topic, you can google "ODS RWI" and read the Lex Jensen papers.&lt;/P&gt;
&lt;PRE&gt;ods excel file="your_folder_location/test.xlsx" 
    options(flow="tables" sheet_name="QSORRES Mapping" absolute_column_width = "22, 23, 16, 60, 60, 13, 60, 65"
            frozen_headers='ON' autofilter="ALL");
ods escapechar='~';

data _null_;
    set work.test(obs=10) end=done;
    /* first two rows */
    if _N_ = 1 then do;
        declare odsout obj();
        obj.table_start();

        /* row 1 */
        obj.row_start(type:'H');
        obj.format_cell(
            data:'RAW',
            column_span: 4,
            just:'C',
            style_attr:'background=#E2EFDA');
        obj.format_cell(
            data:'SDTM',
            column_span: 4,
            just:'C',
            style_attr:'background=#D9E1F2');
        obj.row_end();

        /* row 2, headers */
        obj.row_start(type:'H');
            obj.format_cell(data:'FORMNAME_TEST', style_attr:'background=#E2EFDA');
            obj.format_cell(data:'FORMNAME_PRODUCTION',style_attr:'background=#E2EFDA');
            obj.format_cell(data:'ITEMNAME', style_attr:'background=#E2EFDA');
            obj.format_cell(data:'VALUE', style_attr:'background=#E2EFDA');
            obj.format_cell(data:'QSORRES', style_attr:'background=#D9E1F2');
            obj.format_cell(data:'QSSTRESN', style_attr:'background=#D9E1F2');
            obj.format_cell(data:'QSSTRESC', style_attr:'background=#D9E1F2');
            obj.format_cell(data:'COMMENTS_SPECIAL_CHARACTERS_', style_attr:'background=#D9E1F2');
        obj.row_end();

        obj.body_start();
    end;
    
    /* starts table body at data row 1, excel row 3 */
    obj.row_start();
        obj.format_cell(data:FORMNAME_TEST);
        obj.format_cell(data:FORMNAME_PRODUCTION);
        obj.format_cell(data:ITEMNAME);
        obj.format_cell(data:VALUE);
        obj.format_cell(data:QSORRES);
        obj.format_cell(data:QSSTRESN);
        obj.format_cell(data:QSSTRESC);
        obj.format_cell(data:COMMENTS_SPECIAL_CHARACTERS_);
    obj.row_end();

    if done then do;
        obj.body_end();
        obj.table_end();
    end;
run;


ods _all_ close;&lt;/PRE&gt;
&lt;P&gt;Also note that, you need to specify your styles in each "format_cell" method.&lt;/P&gt;
&lt;P&gt;Links below to help you quickly get started:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/rnd/base/ods/Tipsheet_RWI.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/rnd/base/ods/Tipsheet_RWI.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/wuss/2019/210_Final_Paper_PDF.pdf" target="_blank" rel="noopener"&gt;https://www.lexjansen.com/wuss/2019/210_Final_Paper_PDF.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;format_cell method link&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsadvug/p12q0pykppxbz8n1200luexgbz4t.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsadvug/p12q0pykppxbz8n1200luexgbz4t.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 08:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Specifically-Control-Background-Color-of-Merged-Cells-ODS-Excel/m-p/773564#M25353</guid>
      <dc:creator>happy_sas_kitty</dc:creator>
      <dc:date>2021-10-12T08:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Specifically Control Background Color of Merged Cells. ODS Excel and Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Specifically-Control-Background-Color-of-Merged-Cells-ODS-Excel/m-p/773662#M25356</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/340087"&gt;@happy_sas_kitty&lt;/a&gt;&amp;nbsp;, this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just need to work on formatting the data cells now! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 14:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Specifically-Control-Background-Color-of-Merged-Cells-ODS-Excel/m-p/773662#M25356</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2021-10-12T14:14:43Z</dc:date>
    </item>
  </channel>
</rss>

