<?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: How to correctly format Pivot Tables and create multiple sheets? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257382#M309962</link>
    <description>&lt;P&gt;I don't use pivot tables unless someone threatens me so I'm not very helpful with that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually I haven't actually done an Excel pivot table in something like seven years. With SAS I determine with my report customers what information they want and generate a table that looks that way using one of the SAS report procedures generally Print or Tabulate and occasional Report.&lt;/P&gt;
&lt;P&gt;Then output can go to ODS&amp;nbsp;RTF, PDF or tagsets.Excelxp (or all at the same time if needed).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2016 17:37:42 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-03-17T17:37:42Z</dc:date>
    <item>
      <title>How to correctly format Pivot Tables and create multiple sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257278#M309959</link>
      <description>&lt;P&gt;I decided to stop while I am ahead. My goal is to create a workbook that has a few mulitple pivot tables and also format the numbers. When I attempt the process for formating, the data&amp;nbsp;part is blank.&amp;nbsp;I do not get the mulitple worksheets. I am new to this approach&amp;nbsp;so I am sure that I missed something.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my snippet for the code:&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;filename&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;temp&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;url&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'&lt;A href="http://support.sas.com/rnd/base/ods/odsmarkup/tableeditor/tableeditor.tpl'" target="_blank"&gt;http://support.sas.com/rnd/base/ods/odsmarkup/tableeditor/tableeditor.tpl'&lt;/A&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%include&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;temp&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ods&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; tagsets.tableeditor &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;file&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"&amp;amp;path\enroll.html"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;options(&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;pivot_series=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"yes"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;button_text = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"PivotTable"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;AUTO_EXCEL=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Yes"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;pivotpage = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"county_nm,race_desc | county_nm,race_desc | county_nm,race_desc"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;pivotrow = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"PROGRAM_AREA_DESC | CURRICULUM_NM | DEGREE_PURSUED"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;pivotcol = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"reporting_term,gender_code | reporting_term,gender_code | reporting_term,gender_code"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;pivotdata = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"student_cnt | studednt_cnt | student_cnt"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;pivotdata_stats = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"sum | sum | sum"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;/*pivotdata_fmt="#,###"*/&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;excel_save_file=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"&amp;amp;path\enroll.xls"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*SHEET_NAME="Program Area"*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;print&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=enroll &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;noobs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ods&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; tagsets.tableeditor &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;close&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 13:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257278#M309959</guid>
      <dc:creator>TashaBee</dc:creator>
      <dc:date>2016-03-17T13:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly format Pivot Tables and create multiple sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257339#M309960</link>
      <description>&lt;P&gt;I don't use the tableeditor tagset so can't make a targeted response. We would need some example data, please provide as a data step we can run as importing from an Excel file is likely not to duplicate your data in terms of type and other characteristics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing that you should look at if the example code was copy and paste: you have a variable &lt;FONT color="#800080" face="Courier New"&gt;studednt_cnt &lt;/FONT&gt;that I suspect you meant to be student_cnt.&lt;/P&gt;
&lt;P&gt;I have no idea what a mis-spelled word does in the tagset but I doubt it is going to do what you intend.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 15:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257339#M309960</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-17T15:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly format Pivot Tables and create multiple sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257356#M309961</link>
      <description>That spelling error was typed in quickly because I had initially removed it. Is there another way to pivot tables with tableeditor? I took a class and that was used.</description>
      <pubDate>Thu, 17 Mar 2016 16:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257356#M309961</guid>
      <dc:creator>TashaBee</dc:creator>
      <dc:date>2016-03-17T16:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly format Pivot Tables and create multiple sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257382#M309962</link>
      <description>&lt;P&gt;I don't use pivot tables unless someone threatens me so I'm not very helpful with that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually I haven't actually done an Excel pivot table in something like seven years. With SAS I determine with my report customers what information they want and generate a table that looks that way using one of the SAS report procedures generally Print or Tabulate and occasional Report.&lt;/P&gt;
&lt;P&gt;Then output can go to ODS&amp;nbsp;RTF, PDF or tagsets.Excelxp (or all at the same time if needed).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 17:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257382#M309962</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-17T17:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly format Pivot Tables and create multiple sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257432#M309963</link>
      <description>I haven't used tastes either, and haven't heard of the possibility to do pivoting directly from it. Not saying it couldn't be done...&lt;BR /&gt;For pivots I think that either SAS Addin for MS Office or use SAS data as a data source (OLEDB or ODBC) are more widely used.</description>
      <pubDate>Thu, 17 Mar 2016 19:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257432#M309963</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-03-17T19:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly format Pivot Tables and create multiple sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257952#M309964</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't manage yet to get the tableeditor work correctly for me, fulfilling all the requirements I had. So I chose to work with ODS Tagset ExcelXp to output my data and added some vbs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This paper helped me to program my pivot table directly from SAS, works like a charm&lt;/P&gt;&lt;P&gt;&lt;A title="Creating Microsoft Excel PivotTables in a Jiffy from SAS® Data" href="http://www2.sas.com/proceedings/sugi31/035-31.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi31/035-31.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After inserting the pivot I convert my xml to a native xlsx file&lt;BR /&gt;one way to do this can be found here:&lt;BR /&gt;&lt;A title="Sample 43496: Convert files created using an ODS destination to native Microsoft Excel files" href="http://support.sas.com/kb/43/496.html" target="_blank"&gt;http://support.sas.com/kb/43/496.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally i noticed that I had to refresh the xlsx. Although it can be done with 3 clics in excel, I chose to do this directly from SAS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main vbs code you need to do this (using the proceedings described in the above paper) is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;         put " Dim oXL ";
         put " Dim objWorkBook";
         put " Set oXL = CreateObject(""Excel.Application"")";

         %*Open xlsx file, refresh (pivot) Table and save;
         put " Set objWorkBook = oXL.Workbooks.&lt;FONT color="#FF0000"&gt;Open&lt;/FONT&gt;(""&amp;amp;xlsxFileName."")";

         put " objWorkBook.&lt;FONT color="#FF0000"&gt;RefreshAll&lt;/FONT&gt;";
         put " oXL.ActiveWorkBook.&lt;FONT color="#FF0000"&gt;SaveAs&lt;/FONT&gt; ""&amp;amp;xlsxFileName."",51";
         put " oXL.DisplayAlerts = True";
         put " oXL.ActiveWorkBook.Close SaveChanges = True";
         put " oXL.Quit";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2016 08:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-format-Pivot-Tables-and-create-multiple-sheets/m-p/257952#M309964</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2016-03-23T08:30:50Z</dc:date>
    </item>
  </channel>
</rss>

