<?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 year from a date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451722#M211189</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203127"&gt;@Hope18&lt;/a&gt;&amp;nbsp;You could close the thread by marking&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;'s answer as accepted solution&lt;/P&gt;</description>
    <pubDate>Thu, 05 Apr 2018 23:59:52 GMT</pubDate>
    <dc:creator>MarkWik</dc:creator>
    <dc:date>2018-04-05T23:59:52Z</dc:date>
    <item>
      <title>Extract year from a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451699#M211185</link>
      <description>&lt;P&gt;I would like to extract the only year from the date as a new variable how do I write the program?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 21:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451699#M211185</guid>
      <dc:creator>Hope18</dc:creator>
      <dc:date>2018-04-05T21:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Extract year from a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451702#M211186</link>
      <description>&lt;P&gt;It depends, but usually you would use a data step and the &lt;A href="https://go.documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p13eycdrmfb0l8n1492z3wocpt3s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;YEAR() function&lt;/A&gt; for starters.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can run the example below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data year_demo;
set sashelp.stocks;
year = year(date);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203127"&gt;@Hope18&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I would like to extract the only year from the date as a new variable how do I write the program?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 13:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451702#M211186</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-01T13:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extract year from a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451704#M211187</link>
      <description>&lt;P&gt;It depends on how your date is stored - for example if it's a SAS datetime you can use the date part function&amp;nbsp;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0rttbu7w62xgzn1damccyuwpld8.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=ja" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0rttbu7w62xgzn1damccyuwpld8.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=ja&lt;/A&gt; or if it's a character then the substr function&amp;nbsp;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0n08xougp40i5n1xw7njpcy0a2b.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=ja" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0n08xougp40i5n1xw7njpcy0a2b.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=ja&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you tell us how it's stored we can give you a concrete example.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 21:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451704#M211187</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-04-05T21:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extract year from a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451710#M211188</link>
      <description>&lt;P&gt;Thank you guys this was helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 22:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451710#M211188</guid>
      <dc:creator>Hope18</dc:creator>
      <dc:date>2018-04-05T22:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extract year from a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451722#M211189</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203127"&gt;@Hope18&lt;/a&gt;&amp;nbsp;You could close the thread by marking&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;'s answer as accepted solution&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 23:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-year-from-a-date/m-p/451722#M211189</guid>
      <dc:creator>MarkWik</dc:creator>
      <dc:date>2018-04-05T23:59:52Z</dc:date>
    </item>
  </channel>
</rss>

