<?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 variables by year in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Grouping-variables-by-year/m-p/699636#M37642</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/357526"&gt;@adriannek&lt;/a&gt;&amp;nbsp; You could use the &lt;STRONG&gt;YEAR&lt;/STRONG&gt; function to create a new variable and group by&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, in a PROC you could use &lt;EM&gt;&lt;STRONG&gt;YEAR4&lt;/STRONG&gt;&lt;/EM&gt;. format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
 input date :date9.;
 format date date9.;
 cards;
01JAN2015
01FEB2015
01MAR2015
01APR2015
01MAY2015
01SEP2020
01OCT2020
01NOV2020
;

proc sql;
 select year(date) as year, count(*) as count
 from have
 group by year;
quit;
/*Or*/
proc summary data=have nway;
 class date;
 format date year4.;
 output out= want(drop=_type_);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Nov 2020 23:12:17 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-11-17T23:12:17Z</dc:date>
    <item>
      <title>Grouping variables by year</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Grouping-variables-by-year/m-p/699632#M37641</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently using SAS Enterprise Guide 7.1 for one of my classes and I'm having a tough time grouping these date variables. I have a dataset ranging from 2015 to 2020. The Date column is listed as:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;01JAN2015&lt;/P&gt;&lt;P&gt;01FEB2015&lt;/P&gt;&lt;P&gt;01MAR2015&lt;/P&gt;&lt;P&gt;01APR2015&lt;/P&gt;&lt;P&gt;01MAY2015&lt;/P&gt;&lt;P&gt;...(and so on)...&lt;/P&gt;&lt;P&gt;01SEP2020&lt;/P&gt;&lt;P&gt;01OCT2020&lt;/P&gt;&lt;P&gt;01NOV2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to group these into separate year – how would I do that? I tried using the recoding column, but I'm guessing that the format needs to be changed from .DATE9 to something else (?) Any ideas/suggestions? Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 22:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Grouping-variables-by-year/m-p/699632#M37641</guid>
      <dc:creator>adriannek</dc:creator>
      <dc:date>2020-11-17T22:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping variables by year</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Grouping-variables-by-year/m-p/699636#M37642</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/357526"&gt;@adriannek&lt;/a&gt;&amp;nbsp; You could use the &lt;STRONG&gt;YEAR&lt;/STRONG&gt; function to create a new variable and group by&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, in a PROC you could use &lt;EM&gt;&lt;STRONG&gt;YEAR4&lt;/STRONG&gt;&lt;/EM&gt;. format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
 input date :date9.;
 format date date9.;
 cards;
01JAN2015
01FEB2015
01MAR2015
01APR2015
01MAY2015
01SEP2020
01OCT2020
01NOV2020
;

proc sql;
 select year(date) as year, count(*) as count
 from have
 group by year;
quit;
/*Or*/
proc summary data=have nway;
 class date;
 format date year4.;
 output out= want(drop=_type_);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Nov 2020 23:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Grouping-variables-by-year/m-p/699636#M37642</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-17T23:12:17Z</dc:date>
    </item>
  </channel>
</rss>

