<?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: Automating Excel pivot table in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174425#M264567</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try combination of ods tagsets and proc tabulate to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 May 2014 17:01:14 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2014-05-27T17:01:14Z</dc:date>
    <item>
      <title>Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174423#M264565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My SAS program generates an excel with 1 year of data and i manually paste the data into a pivot table (excel) and send it to users. We need to automate it and looking if it can be done in SAS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 16:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174423#M264565</guid>
      <dc:creator>archana</dc:creator>
      <dc:date>2014-05-27T16:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174424#M264566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My first idea whenever I see 'pivot table' is to make the table in SAS and export that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 16:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174424#M264566</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-05-27T16:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174425#M264567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try combination of ods tagsets and proc tabulate to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 17:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174425#M264567</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-05-27T17:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174426#M264568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it can.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How - there are many different ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One is to replicate exactly what you're doing through DDE - which is considered outdated technology but still useful in my opinion.&lt;/P&gt;&lt;P&gt;Another is to duplicate the results exactly and export to Excel via ODS, tagsets.excelxp.&lt;/P&gt;&lt;P&gt;And another is to use ODS TableEditor which mimics the Pivot table a bit better, but is ugly (visually) in my opinion. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html" title="http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html"&gt;Base SAS: Demo: ExcelXP Tagset and Microsoft Excel&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/rnd/base/ods/odsmarkup/tableeditor/" title="http://support.sas.com/rnd/base/ods/odsmarkup/tableeditor/"&gt;Base SAS: Creating a Data Grid Like VB.NET&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pivot Tables - Build in Excel, export out SAS data set, use DDE to force refresh&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="205621" __jive_macro_name="message" class="jive_macro jive_macro_message" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 17:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174426#M264568</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-27T17:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174427#M264569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code from the discussion you have attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Tell SAS to open Excel */&lt;/P&gt;&lt;P&gt;options noxwait noxsync;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=system('start excel');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=sleep(10);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Execute VBA code via SAS DDE - open file, select sheet with pivot, put cursor on pivot table and refresh pivot table */&lt;/P&gt;&lt;P&gt;filename cmds dde 'excel|system';&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file cmds;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "[open(""\\&amp;amp;path\&amp;amp;f_name..xlsx"")]";&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '[workbook.activate("Pivot")]';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '[select("R1C1")]';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '[pivot.refresh()]';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "[save()]";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "[quit()]";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please explain the above code or point me any link where i can get better explanation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 17:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174427#M264569</guid>
      <dc:creator>archana</dc:creator>
      <dc:date>2014-05-27T17:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174428#M264570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the DDE code to automatically refresh a pivot table, based on the option of creating a Pivot Table template and using SAS to export out the new data, and then to refresh the file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first two steps are not shown here and are something you'd need to design on your own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For updating the pivot table there are comments in the code, but I can expand on them I suppose:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Tell SAS to open Excel */&lt;/P&gt;&lt;P&gt;options noxwait noxsync;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=system('start excel'); *Open Excel;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=sleep(10);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Execute VBA code via SAS DDE - open file, select sheet with pivot, put cursor on pivot table and refresh pivot table */&lt;/P&gt;&lt;P&gt;filename cmds dde 'excel|system';&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file cmds;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "[open(""\\&amp;amp;path\&amp;amp;f_name..xlsx"")]";&amp;nbsp; *Open a specific file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '[workbook.activate("Pivot")]'; *Navigate to the sheet called Pivot;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '[select("R1C1")]'; *Select the first cell A1, you reference cells as Row#Column# in DDE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '[pivot.refresh()]'; *Refresh the pivot table source;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "[save()]"; *Save the excel file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "[quit()]"; *Quit Excel;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 19:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/174428#M264570</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-27T19:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/439814#M264571</link>
      <description>&lt;P&gt;I know this is a very old thread but it pertains to exactly what my question is today.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one tab with data and a summary tab with multiple pivot tables all pointing to that data.&amp;nbsp; I have this all automated using an excel template.&amp;nbsp; I need to distribute the file with all the pivot tables already updated.&amp;nbsp; The problem is this piece of the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '[pivot.refresh()]';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first data step works for all pivot tables in&amp;nbsp;column 1.&amp;nbsp; Is there a way to refresh ALL?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;options&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Verdana" size="2"&gt;noxwait&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Verdana" size="2"&gt;noxsync&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Verdana" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Verdana" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Verdana" size="2"&gt; rc=system(&lt;/FONT&gt;&lt;FONT color="#800080" face="Verdana" size="2"&gt;'start excel'&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Verdana" size="2"&gt; rc=sleep(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Verdana" size="2"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Verdana" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Verdana" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Execute VBA code via SAS DDE - open file, select sheet with pivot, put cursor on pivot table and refresh pivot table */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;filename&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt; cmds &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;dde&lt;/FONT&gt; &lt;FONT color="#800080" face="Verdana" size="2"&gt;'excel|system'&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Verdana" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Verdana" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;file&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt; cmds;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Verdana" size="2"&gt;put "[open(""\\&amp;amp;path\&amp;amp;f_name..xlsx"")]";&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;put&lt;/FONT&gt; &lt;FONT color="#800080" face="Verdana" size="2"&gt;'[worksheet.activate("Summary")]'&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;put&lt;/FONT&gt; &lt;FONT color="#800080" face="Verdana" size="2"&gt;'[select("R5C1")]'&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;put&lt;/FONT&gt; &lt;FONT color="#800080" face="Verdana" size="2"&gt;'[pivot.refresh()]'&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;put&lt;/FONT&gt; &lt;FONT color="#800080" face="Verdana" size="2"&gt;"[save()]"&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Verdana" size="2"&gt;put&lt;/FONT&gt; &lt;FONT color="#800080" face="Verdana" size="2"&gt;"[quit()]"&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Verdana" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 20:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/439814#M264571</guid>
      <dc:creator>jacqelynl49</dc:creator>
      <dc:date>2018-02-23T20:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel pivot table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/439896#M264572</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18819"&gt;@jacqelynl49&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Please don't post new questions into old threads but ask a new question and reference the old thread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for using DDE: I strongly advice against it as you're creating legacy which can cause significant migration problems/costs when moving to a modern SAS architecture. &lt;A href="https://blogs.sas.com/content/sasdummy/2014/10/14/dde-is-doa/" target="_blank"&gt;https://blogs.sas.com/content/sasdummy/2014/10/14/dde-is-doa/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 01:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Excel-pivot-table-in-SAS/m-p/439896#M264572</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-02-24T01:03:34Z</dc:date>
    </item>
  </channel>
</rss>

