<?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: extract years from dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666320#M199339</link>
    <description>&lt;P&gt;This doesn't look like a date, but a datetime-value. Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format dateVar dtYear4.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in proc freq.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jul 2020 10:20:43 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2020-07-01T10:20:43Z</dc:date>
    <item>
      <title>extract years from dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666318#M199338</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have many dates like this: 01.01.2018:00:00:00’. Now I want to see just the years in a proc freq. How can I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanx a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Caro&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 10:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666318#M199338</guid>
      <dc:creator>Caro17</dc:creator>
      <dc:date>2020-07-01T10:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: extract years from dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666320#M199339</link>
      <description>&lt;P&gt;This doesn't look like a date, but a datetime-value. Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format dateVar dtYear4.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in proc freq.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 10:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666320#M199339</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-07-01T10:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: extract years from dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666321#M199340</link>
      <description>&lt;P&gt;Use the Dtyear. format like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    do datetime = 1 to 1e9 by 1e4;
        x = 1;
        output;
    end;
    format datetime datetime20.;
run;

proc freq data=have;
    tables datetime;
    format datetime dtyear.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Jul 2020 10:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666321#M199340</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-07-01T10:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: extract years from dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666322#M199341</link>
      <description>&lt;P&gt;Just assign the&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=n0h7yad9hjgydgn1ijrkvzq8s7jy.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;DTYEAR4.&lt;/A&gt;&amp;nbsp;format to your date variable, and PROC FREQ will automatically group by years:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input datetime :e8601dt19.;
format datetime nldatms19.;
datalines;
2018-01-01T00:00:00
2018-01-01T00:00:00
2019-01-01T00:00:00
;

proc freq data=have;
format datetime dtyear4.;
tables datetime;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Jul 2020 10:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-years-from-dates/m-p/666322#M199341</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-01T10:24:39Z</dc:date>
    </item>
  </channel>
</rss>

