<?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: PROC Report Grouping Dates (Across) by Year and Half. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423103#M68088</link>
    <description>&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aksel&lt;/P&gt;</description>
    <pubDate>Thu, 21 Dec 2017 14:57:20 GMT</pubDate>
    <dc:creator>asdf12_12</dc:creator>
    <dc:date>2017-12-21T14:57:20Z</dc:date>
    <item>
      <title>PROC Report Grouping Dates (Across) by Year and Half.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/422998#M68082</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have successfully managed to get a report out using PROC Report the way I wanted by using this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT DATA=WORK.RANK_ALL;
COLUMNS Rank Grouping REGROUPING Amounts, Summary_date ('Overall' AMOUNTS = TotalAmount) _dummy ;
WHERE SEGMENT_Lvl_1 EQ 'Bespoke' AND YEAR(SUMMARY_DATE)ne 2017;
DEFINE Rank / Group '' NOPRINT;
DEFINE Grouping / GROUP ORDER=INTERNAL '' LEFT;
DEFINE REGROUPING / GROUP '' ;
DEFINE SUMMARY_DATE / ACROSS ORDER=INTERNAL '' FORMAT=DDMMYYd10.; /*mmyyd.*/
DEFINE AMOUNTS / ANALYSIS SUM '' FORMAT=COMMA20.2;
DEFINE _dummy / COMPUTED '' NOPRINT;
DEFINE TotalAmount / SUM 'Total' NOPRINT;
BREAK AFTER Rank / SUMMARIZE STYLE={foreground=black fontweight=bold fontstyle=italic};
COMPUTE _dummy / CHAR LENGTH = 21;
	_dummy = catx(":", Rank, _break_);
		IF lowcase(_break_) = "rank" AND Rank NOT IN ('a','b','e','f','i','j','k','l','m') THEN DO;
		REGROUPING = "Total";
		CALL MISSING(Rank);
		END;
		IF lowcase(_break_) = "rank" AND Rank IN ('a','b','e','f','i','j','k','l','m') THEN DO;
		CALL MISSING(Rank, REGROUPING);
		CALL MISSING(_c3_,_c4_,_c5_,_c6_,_c7_,_c8_,_c9_,_c10_,_c11_,_c12_,_c13_,_c14_,_c15_,_c16_,_c17_,_c18_,_c19_,_c20_,_c21_,_c22_,_c23_,_c24_,_c25_,_c26_);
		END;

ENDCOMP;
COMPUTE AFTER Rank;
	LINE '';
ENDCOMP;


RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This data grabs a ranked table and displays something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Report.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17469i00D7174A19ECDF70/image-size/large?v=v2&amp;amp;px=999" role="button" title="Report.JPG" alt="Report.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you can see I have a dates from Jan 16 up until Nov 2017. &amp;nbsp;What I want to be able to do is to group the Dates so that 2016 is one group, and since 2017 is not complete, have it as 2017 H1 and 2017 H2. &amp;nbsp;So basically the idea is to reduce the columns down to 3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or guidance would be most welcomed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aksel&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 09:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/422998#M68082</guid>
      <dc:creator>asdf12_12</dc:creator>
      <dc:date>2017-12-21T09:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Grouping Dates (Across) by Year and Half.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423038#M68085</link>
      <description>&lt;P&gt;You can use nested formats to achieve this. Basically you specify a date range and the porper format to use.&lt;/P&gt;
&lt;P&gt;Below is an example that shows this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently the current year is hard coded, but this can be made dynamic as well&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  do groupValue = "A", "B";
    do someDate = intnx("year", today(), -2, "B") to mdy(8,15, year(today()));
      value = ceil(ranuni(0) * 1000);
      output;
    end;
  end;
  format
    someDate date9.
    value commax14.
  ;
run;

proc format;
  value year_current
    low - "31dec2016"d = [year4.]
    "01jan2017"d - "31jul2017"d = "2017H1"
    "01aug2017"d - "31dec2017"d = "2017H2"
  ;
run;

proc report data=have;
  column groupValue someDate, value;
  define groupValue / group;
  define someDate / across format=year_current.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Dec 2017 10:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423038#M68085</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-12-21T10:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Grouping Dates (Across) by Year and Half.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423103#M68088</link>
      <description>&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aksel&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 14:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423103#M68088</guid>
      <dc:creator>asdf12_12</dc:creator>
      <dc:date>2017-12-21T14:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Grouping Dates (Across) by Year and Half.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423108#M68089</link>
      <description>&lt;P&gt;One follow up question if I may;&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="Capture.JPG" style="width: 315px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17494i4F3A6608BC7E8E7B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I do separate calculations on each row? &amp;nbsp;I want row A values to be AVERAGE (mean) and row B to be SUM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aksel&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 15:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423108#M68089</guid>
      <dc:creator>asdf12_12</dc:creator>
      <dc:date>2017-12-21T15:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Grouping Dates (Across) by Year and Half.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423117#M68091</link>
      <description>&lt;P&gt;Please open a new discussion, with the appropriate title, this makes it easier&amp;nbsp;for everyone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For better understanding provide some test data or use data from SASHELP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for understanding.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 15:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423117#M68091</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-12-21T15:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Grouping Dates (Across) by Year and Half.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423118#M68092</link>
      <description>Of course.</description>
      <pubDate>Thu, 21 Dec 2017 15:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Report-Grouping-Dates-Across-by-Year-and-Half/m-p/423118#M68092</guid>
      <dc:creator>asdf12_12</dc:creator>
      <dc:date>2017-12-21T15:22:31Z</dc:date>
    </item>
  </channel>
</rss>

