<?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: send excel subtotal function to excel in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5424#M2187</link>
    <description>Hi:&lt;BR /&gt;
  Look at the example of using the TAGATTR attribute in a STYLE override with TAGSETS.EXCELXP here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html#formats" target="_blank"&gt;http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html#formats&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  Notice that the formula is in Row/Column notation and not A1..A14 notation.&lt;BR /&gt;
 &lt;BR /&gt;
  I believe you will also need to download an updated copy of the ExcelXP tagset. I don't believe that formulas worked in the original tagset that was shipped with SAS 9.1.3 -- but Tech Support could help you with that.&lt;BR /&gt;
&lt;BR /&gt;
  The issue with the example is that they are using proc print to touch every row with a formula and you want to change the subtotal line. So it's good that you're using PROC REPORT. You can send a formula along with the value -- so that if somebody changes a number, the subtotal automatically changes -- using the same TAGATTR syntax as shown in the Tech Support note.&lt;BR /&gt;
&lt;BR /&gt;
  I'm not a real whiz with Excel, so I don't know how you get around needing to know how many rows to include in the formula, but this example worked for me (assuming only 2 report rows and 1 header and 2 subtotal/total line. I always use =SUM in Excel, so I'm not sure what you mean by the SUBTOTAL function. &lt;BR /&gt;
  &lt;BR /&gt;
Perhaps Tech Support can provide more help.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data prdsale;&lt;BR /&gt;
  set sashelp.prdsale;&lt;BR /&gt;
  where country = 'GERMANY';&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
ods tagsets.excelxp file='formula2.xls' style=statistical;&lt;BR /&gt;
   &lt;BR /&gt;
  proc report data=prdsale nowd split='*'&lt;BR /&gt;
     style(header)={font_size=10pt font_weight=bold};&lt;BR /&gt;
     column country region predict actual;&lt;BR /&gt;
     where country = 'GERMANY';&lt;BR /&gt;
     define country / group;&lt;BR /&gt;
     define region / group;&lt;BR /&gt;
     define predict /'Predicted*Sales' style={tagattr='format:Currency'};&lt;BR /&gt;
     define actual / 'Actual*Sales' style={tagattr='format:Currency'};&lt;BR /&gt;
           &lt;BR /&gt;
     compute predict;&lt;BR /&gt;
       ** note for this formula, you have to know how report rows there are;&lt;BR /&gt;
       ** and how many header rows there are in the final worksheet;&lt;BR /&gt;
       if _break_ = '_RBREAK_' then do;&lt;BR /&gt;
          Country = 'Total';&lt;BR /&gt;
          call define (_col_,'STYLE',&lt;BR /&gt;
               'style={tagattr="format:Currency formula:=SUM(R[-2]C:R[-1]C) "');&lt;BR /&gt;
       end; &lt;BR /&gt;
     endcomp;&lt;BR /&gt;
        &lt;BR /&gt;
     compute actual;&lt;BR /&gt;
       if _break_ = '_RBREAK_' then do;&lt;BR /&gt;
          call define (_col_,'STYLE',&lt;BR /&gt;
               'style={tagattr="format:Currency formula:=SUM(R[-2]C:R[-1]C) "');&lt;BR /&gt;
       end; &lt;BR /&gt;
     endcomp;&lt;BR /&gt;
     &lt;BR /&gt;
     rbreak after /summarize;&lt;BR /&gt;
    &lt;BR /&gt;
  run;&lt;BR /&gt;
  &lt;BR /&gt;
ods tagsets.excelxp close;&lt;BR /&gt;
 &lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 08 Nov 2007 23:39:53 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-11-08T23:39:53Z</dc:date>
    <item>
      <title>send excel subtotal function to excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5423#M2186</link>
      <description>Hello,&lt;BR /&gt;
Is there a way to create an excel function in SAS and then send it to Excel via ODS?&lt;BR /&gt;
Specifically, I'd like to subtotal my data and have this show up in Excel as a subtotal - not a value. &lt;BR /&gt;
Right now, I am stuck between either having to do create subtotals in proc report and send them over to Excel as values, or just creating a list and having to manually subtotal it in Excel afterwards. &lt;BR /&gt;
If there was a tagset option to do an XML subtotal that Excel recognizes, that would be great. If I can do a style over-ride to forcefeed it into Excel, that is fine too, if someone can point me in the right direction.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Joe</description>
      <pubDate>Thu, 08 Nov 2007 21:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5423#M2186</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-11-08T21:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: send excel subtotal function to excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5424#M2187</link>
      <description>Hi:&lt;BR /&gt;
  Look at the example of using the TAGATTR attribute in a STYLE override with TAGSETS.EXCELXP here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html#formats" target="_blank"&gt;http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html#formats&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  Notice that the formula is in Row/Column notation and not A1..A14 notation.&lt;BR /&gt;
 &lt;BR /&gt;
  I believe you will also need to download an updated copy of the ExcelXP tagset. I don't believe that formulas worked in the original tagset that was shipped with SAS 9.1.3 -- but Tech Support could help you with that.&lt;BR /&gt;
&lt;BR /&gt;
  The issue with the example is that they are using proc print to touch every row with a formula and you want to change the subtotal line. So it's good that you're using PROC REPORT. You can send a formula along with the value -- so that if somebody changes a number, the subtotal automatically changes -- using the same TAGATTR syntax as shown in the Tech Support note.&lt;BR /&gt;
&lt;BR /&gt;
  I'm not a real whiz with Excel, so I don't know how you get around needing to know how many rows to include in the formula, but this example worked for me (assuming only 2 report rows and 1 header and 2 subtotal/total line. I always use =SUM in Excel, so I'm not sure what you mean by the SUBTOTAL function. &lt;BR /&gt;
  &lt;BR /&gt;
Perhaps Tech Support can provide more help.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data prdsale;&lt;BR /&gt;
  set sashelp.prdsale;&lt;BR /&gt;
  where country = 'GERMANY';&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
ods tagsets.excelxp file='formula2.xls' style=statistical;&lt;BR /&gt;
   &lt;BR /&gt;
  proc report data=prdsale nowd split='*'&lt;BR /&gt;
     style(header)={font_size=10pt font_weight=bold};&lt;BR /&gt;
     column country region predict actual;&lt;BR /&gt;
     where country = 'GERMANY';&lt;BR /&gt;
     define country / group;&lt;BR /&gt;
     define region / group;&lt;BR /&gt;
     define predict /'Predicted*Sales' style={tagattr='format:Currency'};&lt;BR /&gt;
     define actual / 'Actual*Sales' style={tagattr='format:Currency'};&lt;BR /&gt;
           &lt;BR /&gt;
     compute predict;&lt;BR /&gt;
       ** note for this formula, you have to know how report rows there are;&lt;BR /&gt;
       ** and how many header rows there are in the final worksheet;&lt;BR /&gt;
       if _break_ = '_RBREAK_' then do;&lt;BR /&gt;
          Country = 'Total';&lt;BR /&gt;
          call define (_col_,'STYLE',&lt;BR /&gt;
               'style={tagattr="format:Currency formula:=SUM(R[-2]C:R[-1]C) "');&lt;BR /&gt;
       end; &lt;BR /&gt;
     endcomp;&lt;BR /&gt;
        &lt;BR /&gt;
     compute actual;&lt;BR /&gt;
       if _break_ = '_RBREAK_' then do;&lt;BR /&gt;
          call define (_col_,'STYLE',&lt;BR /&gt;
               'style={tagattr="format:Currency formula:=SUM(R[-2]C:R[-1]C) "');&lt;BR /&gt;
       end; &lt;BR /&gt;
     endcomp;&lt;BR /&gt;
     &lt;BR /&gt;
     rbreak after /summarize;&lt;BR /&gt;
    &lt;BR /&gt;
  run;&lt;BR /&gt;
  &lt;BR /&gt;
ods tagsets.excelxp close;&lt;BR /&gt;
 &lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 08 Nov 2007 23:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5424#M2187</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-11-08T23:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: send excel subtotal function to excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5425#M2188</link>
      <description>As Cynthia said, it's good that you're using PROC REPORT, because you can feed the SUBTOTAL function (or the SUM function) to Excel.&lt;BR /&gt;
&lt;BR /&gt;
I create worksheets with filters, and use this code to put a filtered subtotal at the top of the page:&lt;BR /&gt;
&lt;BR /&gt;
   compute before _page_;                                       &lt;BR /&gt;
      line '="Membership Count after Filtering: '               &lt;BR /&gt;
           '"&amp;amp;TEXT(SUBTOTAL(9,r5c1:r'                           &lt;BR /&gt;
           "%sysevalf(&amp;amp;dhmo_filtered_SUMMARY_ROWS.+4, integer)" &lt;BR /&gt;
           'c1),"#,##0")';                                      &lt;BR /&gt;
   endcomp;                                                     &lt;BR /&gt;
&lt;BR /&gt;
where an external process has figured out the number of rows.  I suppose it would be easier to just hardcode something like &lt;BR /&gt;
&lt;BR /&gt;
   =subtotal(9, r5c1:r65536c1)&lt;BR /&gt;
&lt;BR /&gt;
but there might be efficiency considerations.</description>
      <pubDate>Mon, 12 Nov 2007 19:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5425#M2188</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2007-11-12T19:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: send excel subtotal function to excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5426#M2189</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to create an xls-File with a Formula. But when I run the program EGuide hangs...&lt;BR /&gt;
&lt;BR /&gt;
Code:&lt;BR /&gt;
proc report data=READY4EXCEL  headskip missing nowd;&lt;BR /&gt;
column ('Material Properties' PG IG matnum matdesc laundat globretdat pp rrp mape )  ('Order Quantity' timeid,(stock sonst)) ('Billed Qty' sales),timeid ('FC Qty' predict),timeid revFC deviation comment;&lt;BR /&gt;
	define pg / group 'PG' width=2;&lt;BR /&gt;
	define ig / group 'IG' width=2;&lt;BR /&gt;
	define matnum / group 'Material' width=8;&lt;BR /&gt;
	define matdesc / group 'Description' width=20;&lt;BR /&gt;
	define laundat / group 'Laun Date' width=8;&lt;BR /&gt;
	define globretdat / group 'Ret Date' width=8;&lt;BR /&gt;
	define pp / group 'PP' width=3;&lt;BR /&gt;
	define rrp / group 'RRP' width=3;&lt;BR /&gt;
	define mape / group 'mape' width=5;&lt;BR /&gt;
  define revFC / computed 'Revised FC' width=4;&lt;BR /&gt;
  define deviation / computed 'Dev in %';&lt;BR /&gt;
	define comment / computed 'Comment' width=10;&lt;BR /&gt;
&lt;BR /&gt;
	define timeid / across '' format=monyy5. order=data;&lt;BR /&gt;
	*define oi / analysis sum '';&lt;BR /&gt;
  define stock / analysis sum 'Stock';&lt;BR /&gt;
  define sonst / analysis sum 'DD';&lt;BR /&gt;
  define sales / analysis sum '';&lt;BR /&gt;
  define predict / analysis sum '';&lt;BR /&gt;
&lt;BR /&gt;
  compute revFC / length=8;&lt;BR /&gt;
    revFC =;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
&lt;BR /&gt;
  compute deviation;&lt;BR /&gt;
    call define(_col_,'style',"style={tagattr='Formula:=IF(RC[-2]&amp;gt;0,RC[-1]/RC[-2]-1,1)'}");&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
&lt;BR /&gt;
  compute comment / char;&lt;BR /&gt;
    comment="";&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
&lt;BR /&gt;
  where pg = "11" and timeid ne .;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Any idea would help,&lt;BR /&gt;
thanks and best regards,&lt;BR /&gt;
Thomas</description>
      <pubDate>Wed, 13 Feb 2008 12:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/send-excel-subtotal-function-to-excel/m-p/5426#M2189</guid>
      <dc:creator>tbatliner</dc:creator>
      <dc:date>2008-02-13T12:04:57Z</dc:date>
    </item>
  </channel>
</rss>

