<?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 Re: add dummy across columns (header)in proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896993#M354466</link>
    <description>&lt;P&gt;This sort of works in HTML output. I'm not sure that Excel will display it the same.&lt;/P&gt;
&lt;P&gt;This places the text "Global" in STN2 so it is not on the left border but makes that column wider. The style overrides remove the borders by appearance but may still appear in Excel. Or leave Global in the leftmost column using the Stn1='Global'&lt;/P&gt;
&lt;PRE&gt;proc report data=AA nowd style(header)=header{background=$back. foreground=$fore.};
column  Stn1 stn2  stn3  stn4 avg1 avg2 avg3 avg4 ;
define stn1 / order ;
define stn2 / order ;
define stn3 / order ;
define stn4 / order;
define avg1 /analysis;
define avg2 / analysis;
define avg3 / analysis;
define avg4 / analysis;

break after stn1 / summarize ;
compute after stn1; 
   stn1='';
   stn2='GLOBAL';
   call define('stn1','style','Style=[ borderrightwidth=0]');
   call define('stn2','style','Style=[borderleftwidth=0 borderrightwidth=0]');
   call define('stn3','style','Style=[borderleftwidth=0 borderrightwidth=0]');
   line ' '  ;
   call define(_row_,'style','style=[ background=white ]');
endcomp;
/* FIN CALCUL DES TOTAUX */

run;&lt;/PRE&gt;
&lt;P&gt;For what it may be worth, the more custom you want a report the more work is needed and it may get to where Proc Report won't do. The data step has a feature called the Report Writing Interface that allows you do stuff like spanning based on other rules and actually spans unlike this example. However, since it is dealing at a very low level to allow that sort of control the syntax is much more complicated.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2023 17:36:23 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-10-03T17:36:23Z</dc:date>
    <item>
      <title>add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896768#M354351</link>
      <description>&lt;PRE&gt;data AA;
  infile datalines dlm=',';
  input Stn $ avg1 avg2 avg3 avg4;
datalines;
NE,11111,11111,11110,5555
NW,22222,11119,22223,2322
SE,33333,33333,33331,2309
SW,44444,44444,44444,1100
;
run;
   
proc report data=AA;

column stn avg1 avg2 avg3 avg4;
define stn / order;
define avg1 /analysis;
define avg2 / analysis;
define avg3 / analysis;
run;&lt;/PRE&gt;&lt;PRE class=""&gt;&lt;SPAN class=""&gt;I want to add dummy columns for an aesthetic display, they must merge above the other columns and I must be able to manage the font size, background color, etc. of these columns, see the example. is it possible to do this please? Thank you for your help&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="snip_0-1696272426962.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88492iD23ED9D176F4E942/image-size/medium?v=v2&amp;amp;px=400" role="button" title="snip_0-1696272426962.png" alt="snip_0-1696272426962.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 18:52:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896768#M354351</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-02T18:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896783#M354357</link>
      <description>&lt;P&gt;Please stop putting discussion into text boxes. That is what the main message window is for. Text boxes are for code or data text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For this:&lt;/P&gt;
&lt;PRE&gt;   
proc report data=AA;

column  stn ("heading one" avg1 avg2) ("heading two" avg3 avg4);
define stn / order;
define avg1 /analysis;
define avg2 / analysis;
define avg3 / analysis;
run;&lt;/PRE&gt;
&lt;P&gt;Note that the ( ) are around both the column heading text and all of the columns to span.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 19:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896783#M354357</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-02T19:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896801#M354363</link>
      <description>&lt;P&gt;I am really sorry for the inconvenience caused, I have just recently started using&amp;nbsp;&lt;SPAN class=""&gt;this site,and I admit that I do not&amp;nbsp;yet master the blocks. Can you explain the concept to me?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;-Concerns my question on sas, how and where I can indicate the style of these two columns (font_size, background...)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 20:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896801#M354363</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-02T20:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896806#M354365</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Take a look at this paper &lt;A href="https://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf&lt;/A&gt; especially at the examples on for Output 12, 13 and 14. The discussion starts at the bottom of page 11.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 20:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896806#M354365</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-10-02T20:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896819#M354369</link>
      <description>&lt;P&gt;Which concept? The ( ) to create a group of items?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The whole bit of controlling appearance one element at a time is complex and time consuming because there are so many moving parts.&lt;/P&gt;
&lt;P&gt;Example of minor basic changes&lt;/P&gt;
&lt;PRE&gt;ods escapechar='^'; 
proc report data=AA;
column  stn ("^S={foreground=red background=green}Heading one" avg1 avg2) 
            ("^S={fontfamily='Times New Roman' fontsize=16pt fontweight=bold}heading two" avg3 avg4);
define stn / order;
define avg1 /analysis;
define avg2 / analysis;
define avg3 / analysis;
run;&lt;/PRE&gt;
&lt;P&gt;The ODS Escapechar option sets a specific character, your choice but should be something not commonly used elsewhere, as a flag to tell SAS that you are going to request style overrides.&lt;/P&gt;
&lt;P&gt;The ^S= is the start of a style override the { to } are the specific elements of the override. The example sets colors in one and the second sets font options.&lt;/P&gt;
&lt;P&gt;Search your on-line help for "&lt;FONT size="4"&gt;Using ODS Styles with Base SAS Report Writing Procedures" for examples.&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;Styles can be applied to cells, cell boarders, columns, variables, headers, column / row headers separately, total lines. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;Procs Print, Report and Tabulate have similar but sometimes quite different details because the procedures behave differently. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV class="xis-procUsing"&gt;
&lt;H1 id="p19yo2oj9l1m58n1utb71ps1vf1b" class="xis-title"&gt;&amp;nbsp;&lt;/H1&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 Oct 2023 20:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896819#M354369</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-02T20:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896901#M354413</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;1) why is there a void around my value? I want the background to be on the entire “heading on” cell&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;2) in the attached images the sas output contains the formatting (background and fore ground), on the other hand the output with ods excel, my excel file did not take the background into account and I need this output&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;is there a reason ? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;how to correct this please&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="snip_2-1696328991867.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88517iA58C4D06DC209F80/image-size/medium?v=v2&amp;amp;px=400" role="button" title="snip_2-1696328991867.png" alt="snip_2-1696328991867.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="snip_3-1696329270390.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88518iAEB5FD17901583A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="snip_3-1696329270390.png" alt="snip_3-1696329270390.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 10:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896901#M354413</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-03T10:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896913#M354424</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Using Traffic Light Skill
*/
data AA;
  infile datalines dlm=',';
  input Stn $ avg1 avg2 avg3 avg4;
datalines;
NE,11111,11111,11110,5555
NW,22222,11119,22223,2322
SE,33333,33333,33331,2309
SW,44444,44444,44444,1100
;
run;
   
proc format;
value $back
'heading one'='green'
'heading two'='blue'
;
value $fore
'avg1','avg2'='yellow'
'avg3','avg4'='red'
other='white'
;
run;

ods excel file='c:\temp\x.xlsx' ;
proc report data=AA nowd style(header)=header{background=$back. foreground=$fore.};
column  stn ("heading one" avg1 avg2) ("heading two" avg3 avg4);
define stn / order style(header)={background=cxEDF2F9};
define avg1 /analysis;
define avg2 / analysis;
define avg3 / analysis;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1696331761250.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88519iF4F6B80FE209FF58/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1696331761250.png" alt="Ksharp_0-1696331761250.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 11:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896913#M354424</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-10-03T11:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896937#M354440</link>
      <description>&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Thank you for taking the time to read my issues, and thank you for responding, you helped me a lot, I am very grateful. I have a question:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Can we merge a total across several group by columns? still with ods excel output&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 13:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896937#M354440</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-03T13:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896949#M354446</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/449477"&gt;@snip&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Thank you for taking the time to read my issues, and thank you for responding, you helped me a lot, I am very grateful. I have a question:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Can we merge a total across several group by columns? still with ods excel output&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You will need to clarify what you mean by "total across several by columns". As in show a before and after appearance.&lt;/P&gt;
&lt;P&gt;If you meant to SUM numeric values, likely yes as Proc Report does allow some custom calculations but depending on data and the structure of the entire report may or may not be easy. Some custom report features require changes to the data to allow such.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 14:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896949#M354446</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-03T14:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896985#M354462</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want a total this way If it's possible in the middle&lt;/P&gt;
&lt;P&gt;Thank's&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data AA;
  infile datalines dlm=',';
  input Stn1 $ stn2 $ stn3 $ stn4 $ avg1 avg2 avg3 avg4;
datalines;
NE,CC,A1,Z2,11111,11111,11110,5555
NE,CC,A1,Z2,11111,11111,11110,5555
NE,SS,A2,N5,11111,11111,11110,5555
TT,HH,QQ,T4,22222,11119,22223,2322
TT,HH,OO,M1,33333,33333,33331,2309
SE,ZZ,KK,P6,44444,44444,44444,1100
;
run;

ods excel file='c:\temp\x.xlsx' ;
proc report data=AA nowd style(header)=header{background=$back. foreground=$fore.};
column  Stn1 stn2  stn3  stn4 avg1 avg2 avg3 avg4 ;
define stn1 / order ;
define stn2 / order ;
define stn3 / order ;
define stn4 / order;
define avg1 /analysis;
define avg2 / analysis;
define avg3 / analysis;
define avg4 / analysis;

break after stn1 / summarize ;
compute after stn1; 
stn1='GLOBAL';

line ' '  ;
call define(_row_,'style','style=[ background=white ]');
endcomp;
/* FIN CALCUL DES TOTAUX */

run;

ods excel close;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&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="snip_1-1696352304102.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88536iF36DED991BEA769A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="snip_1-1696352304102.png" alt="snip_1-1696352304102.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 17:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896985#M354462</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-03T17:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896993#M354466</link>
      <description>&lt;P&gt;This sort of works in HTML output. I'm not sure that Excel will display it the same.&lt;/P&gt;
&lt;P&gt;This places the text "Global" in STN2 so it is not on the left border but makes that column wider. The style overrides remove the borders by appearance but may still appear in Excel. Or leave Global in the leftmost column using the Stn1='Global'&lt;/P&gt;
&lt;PRE&gt;proc report data=AA nowd style(header)=header{background=$back. foreground=$fore.};
column  Stn1 stn2  stn3  stn4 avg1 avg2 avg3 avg4 ;
define stn1 / order ;
define stn2 / order ;
define stn3 / order ;
define stn4 / order;
define avg1 /analysis;
define avg2 / analysis;
define avg3 / analysis;
define avg4 / analysis;

break after stn1 / summarize ;
compute after stn1; 
   stn1='';
   stn2='GLOBAL';
   call define('stn1','style','Style=[ borderrightwidth=0]');
   call define('stn2','style','Style=[borderleftwidth=0 borderrightwidth=0]');
   call define('stn3','style','Style=[borderleftwidth=0 borderrightwidth=0]');
   line ' '  ;
   call define(_row_,'style','style=[ background=white ]');
endcomp;
/* FIN CALCUL DES TOTAUX */

run;&lt;/PRE&gt;
&lt;P&gt;For what it may be worth, the more custom you want a report the more work is needed and it may get to where Proc Report won't do. The data step has a feature called the Report Writing Interface that allows you do stuff like spanning based on other rules and actually spans unlike this example. However, since it is dealing at a very low level to allow that sort of control the syntax is much more complicated.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 17:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/896993#M354466</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-03T17:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/897087#M354500</link>
      <description>&lt;P&gt;OK . You need some advanced skill a.k.a RWI and screw your dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data AA;
  infile datalines dlm=',' truncover;
  input Stn1 :$20. stn2 $ stn3 $ stn4 $ avg1 avg2 avg3 avg4;
datalines;
NE,CC,A1,Z2,11111,11111,11110,5555
NE,CC,A1,Z2,11111,11111,11110,5555
NE,SS,A2,N5,11111,11111,11110,5555
GLOBAL,33,44,55,66
TT,HH,QQ,T4,22222,11119,22223,2322
TT,HH,OO,M1,33333,33333,33331,2309
GLOBAL,33,44,55,66
SE,ZZ,KK,P6,44444,44444,44444,1100
GLOBAL,33,44,55,66
;
run;

ods excel file="c:\temp\spantest.xlsx"   ;

title 'How to span Header Rows amd Data Rpws with RWI and DATA step';
data _null_; 
  set AA end=last; 
  if _N_ = 1 then do; 
      dcl odsout obj(); 
      obj.table_start(); 
      obj.head_start(); 
	  ** Header row 1;
      obj.row_start(type: "Header"); 
      obj.format_cell(text: "heading one", column_span:4,style_attr:"color=black backgroundcolor=gold fontweight=bold"); 
      obj.format_cell(text: "heading two",column_span:4, style_attr:"color=white backgroundcolor=blue fontweight=bold"); 
      obj.row_end(); 
      obj.head_end(); 
	  ** Header row 2;
      obj.row_start(type: "Header"); 
      obj.format_cell(text: "Stn1",  style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.format_cell(text: "Stn2", style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.format_cell(text: "Stn3", style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.format_cell(text: "Stn4", style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.format_cell(text: "avg1", style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.format_cell(text: "avg2",style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.format_cell(text: "avg3", style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.format_cell(text: "avg4",style_attr:"color=black backgroundcolor=cxdddddd fontweight=bold"); 
      obj.row_end(); 
      obj.head_end(); 
    end;
  ** row for every obs;
      obj.row_start(); 
if Stn1='GLOBAL' then do;
      obj.format_cell(data: Stn1, column_span:4,style_attr:"color=black fontweight=bold"); 
end;
else do;
      obj.format_cell(data: Stn1, column_span:1); 
end;
      obj.format_cell(data: Stn2, column_span:1); 
      obj.format_cell(data: Stn3, column_span:1); 
      obj.format_cell(data: Stn4, column_span:1); 
      obj.format_cell(data: avg1, column_span:1); 
      obj.format_cell(data: avg2, column_span:1); 
      obj.format_cell(data: avg3, column_span:1); 
      obj.format_cell(data: avg4, column_span:1); 
      obj.row_end(); 
  if last then do; 
      obj.table_end(); 
    end; 
run;
footnote;title;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1696386193496.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88568i0ACCB0E0909F4C5C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1696386193496.png" alt="Ksharp_0-1696386193496.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 02:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/897087#M354500</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-10-04T02:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: add dummy across columns (header)in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/897443#M354643</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;you are a genius,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt; you managed to pull off something&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN class="Y2IQFc"&gt;very difficult,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt; I can never thank you enough.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt; a big thank-you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 18:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-dummy-across-columns-header-in-proc-report/m-p/897443#M354643</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-05T18:05:45Z</dc:date>
    </item>
  </channel>
</rss>

