<?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 how to get the last two digits of a year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-last-two-digits-of-a-year/m-p/118127#M259495</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to pull out the last two digits of a year.&amp;nbsp; I used the following code, but i get the answer of 65.&amp;nbsp; Can anyone suggest a way I could do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let yeartest=2002;&lt;/P&gt;&lt;P&gt;%let yeartest2=%sysfunc(putn(&amp;amp;yeartest,year2.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to have as the result a variable storing 02&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Celia.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 20 Oct 2013 21:59:46 GMT</pubDate>
    <dc:creator>Celia</dc:creator>
    <dc:date>2013-10-20T21:59:46Z</dc:date>
    <item>
      <title>how to get the last two digits of a year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-last-two-digits-of-a-year/m-p/118127#M259495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to pull out the last two digits of a year.&amp;nbsp; I used the following code, but i get the answer of 65.&amp;nbsp; Can anyone suggest a way I could do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let yeartest=2002;&lt;/P&gt;&lt;P&gt;%let yeartest2=%sysfunc(putn(&amp;amp;yeartest,year2.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to have as the result a variable storing 02&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Celia.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Oct 2013 21:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-last-two-digits-of-a-year/m-p/118127#M259495</guid>
      <dc:creator>Celia</dc:creator>
      <dc:date>2013-10-20T21:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the last two digits of a year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-last-two-digits-of-a-year/m-p/118128#M259496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your example just use %SUBSTR() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let yeartest=2002;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let yeartest2=%substr(&amp;amp;yeartest,3) ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you want to find the last two digits of a DATE value then you can use the YEAR2. format.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%let yeartest2=%sysfunc(today(),year2.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;or&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%let yeartest2=%sysfunc(putn("01JAN1960"d,year2.)) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Oct 2013 23:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-last-two-digits-of-a-year/m-p/118128#M259496</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-10-20T23:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the last two digits of a year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-last-two-digits-of-a-year/m-p/118129#M259497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help Tom.&amp;nbsp; Works a treat.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 00:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-last-two-digits-of-a-year/m-p/118129#M259497</guid>
      <dc:creator>Celia</dc:creator>
      <dc:date>2013-10-21T00:50:55Z</dc:date>
    </item>
  </channel>
</rss>

