<?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: Grouping dates in Excel output in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700345#M2486</link>
    <description>I realize you're OK with it just being alphabetical so you can just use a character format for the date if you wanted.</description>
    <pubDate>Thu, 19 Nov 2020 21:19:44 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-11-19T21:19:44Z</dc:date>
    <item>
      <title>Grouping dates in Excel output</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700273#M2482</link>
      <description>&lt;P&gt;UPDATE: Issue fixed, though not sure what I did to fix it hah.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am successfully exporting a dataset to XLSX using the code below in SAS 9.4. However, in the Collection Date column of the exported file, the dates in the filter are all listed ungrouped...it's just a long list of dates. I'd like to know how to export it so that the days are auto grouped by month and day that I can expand and collapse.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="excel dates .jpg" style="width: 522px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51840iE3C43B890E1B8E5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="excel dates .jpg" alt="excel dates .jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Collection Date variable in SAS is numeric mmddyy10. format, informat 10., (shown as 03/05/2020 in the XLSX output). I have a feeling either I need to add an option in tagset or change the Collection Date variable to a format that Excel will understand and thus group automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/**************/
/*Export files*/
/**************/

/*Location of Excel file output*/
ods noresults; 
ods excel file='PATH.XLSX' style=Printer;

/*Options and variables*/
ods excel options
(sheet_name = "COVID Data by Day" frozen_headers="yes" autofilter="1-2" absolute_column_width="15,35,10,10,10,10,10");

title "COVID Data Report - Totals by Date and Testing Location";
proc report data=counts_date1
style(header) = {background=#32312F foreground=white font_weight=bold};
columns Collection_Date Draw_Location Negative Positive Other Total Positivity_Rate /*Nares Nasopharyngeal Other_sample_type Unknown_sample_type*/;
define Collection_Date / "Collection Date";
define Draw_Location / "Testing Location";
define Positivity_Rate / "Positivity Rate";
/*define Other_sample_type / "Other sample type";*/
/*define Unknown_sample_type / "Unknown sample type";*/
run;
title;

ods excel close;&lt;/PRE&gt;&lt;P&gt;X&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 19:28:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700273#M2482</guid>
      <dc:creator>vegan_renegade</dc:creator>
      <dc:date>2020-11-19T19:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping dates in Excel output</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700280#M2483</link>
      <description>&lt;P&gt;You either need to manually add a variable like that but then Excel will likely treat it as a character not a date, which means that you need to then control the display order somehow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I believe Excel does that now for anything it recognizes as a date so it's a pivot table setting that needs to change.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to right click on the field in the pivot table, select grouping and then in the BY section select how you'd like to group it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At least this was the solution I found a few weeks ago when dealing with the issue. Looking forward to seeing what other people have to say.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301219"&gt;@vegan_renegade&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am successfully exporting a dataset to XLS using the code below. However, in the Collection Date column of the exported file, the dates in the filter are all listed ungrouped...it's just a long list of dates. I'd like to know how to export it so that the days are auto grouped by month and day that I can expand and collapse.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="excel dates .jpg" style="width: 522px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51840iE3C43B890E1B8E5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="excel dates .jpg" alt="excel dates .jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Collection Date variable in SAS is numeric mmddyy10. format, informat 10., (shown as 03/05/2020 in the XLS output). I have a feeling either I need to add an option in tagset or change the Collection Date variable to a format that Excel will understand and thus group automatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/**************/
/*Export files*/
/**************/

/*Location of Excel file output*/
ods noresults; 
ods tagsets.ExcelXP file='PATH.XLS' style=Printer;

/*Options and variables*/
ods tagsets.excelxp options
(sheet_name = "COVID Data by Day" frozen_headers="yes" autofilter="1-2" absolute_column_width="15,35,10,10,10,10,10");

title "COVID Data Report - Totals by Date and Testing Location";
proc report data=counts_date1
style(header) = {background=#32312F foreground=white font_weight=bold};
columns Collection_Date Draw_Location Negative Positive Other Total Positivity_Rate /*Nares Nasopharyngeal Other_sample_type Unknown_sample_type*/;
define Collection_Date / "Collection Date";
define Draw_Location / "Testing Location";
define Positivity_Rate / "Positivity Rate";
/*define Other_sample_type / "Other sample type";*/
/*define Unknown_sample_type / "Unknown sample type";*/
run;
title;

ods tagsets.ExcelXP close;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 17:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700280#M2483</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-19T17:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping dates in Excel output</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700289#M2484</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Thanks, but there is no pivot table. With so many options available at export, I'm sure there's a way to make these grouped automatically rather than manually.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 18:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700289#M2484</guid>
      <dc:creator>vegan_renegade</dc:creator>
      <dc:date>2020-11-19T18:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping dates in Excel output</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700306#M2485</link>
      <description>&lt;P&gt;Update: I played around with a few export options and formats, and I found it worked in CSV format, but since CSV does not save formatting and colors, I reverted back all the changes..and magically the file now exports with the dates grouped in XLSX. Not sure what I did but we are good haha.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 19:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700306#M2485</guid>
      <dc:creator>vegan_renegade</dc:creator>
      <dc:date>2020-11-19T19:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping dates in Excel output</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700345#M2486</link>
      <description>I realize you're OK with it just being alphabetical so you can just use a character format for the date if you wanted.</description>
      <pubDate>Thu, 19 Nov 2020 21:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Grouping-dates-in-Excel-output/m-p/700345#M2486</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-19T21:19:44Z</dc:date>
    </item>
  </channel>
</rss>

