<?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: Converting a numeric year to a date formatted year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-year-to-a-date-formatted-year/m-p/177802#M264842</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are trying to use YEAR as an INFORMAT, when it only exists in SAS as a FORMAT. This means it will only work when you already have a SAS date and you apply it with a PUT function or FORMAT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fiscyear = mdy(1, 1, input(charyear, 4.));&lt;/P&gt;&lt;P&gt;format fiscyear year4.; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To create a SAS date you also need to tell SAS the day and the month of your date, so that fiscyear actually stores 1 Jan 2014, for example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Jul 2014 00:11:18 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2014-07-14T00:11:18Z</dc:date>
    <item>
      <title>Converting a numeric year to a date formatted year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-year-to-a-date-formatted-year/m-p/177800#M264840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a SAS dataset that has a variable, fiscyear, that are years, but are formatted as numeric. I'm trying to convert that variable to a YEAR4. format so that I can use the years as dates in a proc. The code I'm trying to use (shown below) is producing this error:&lt;/P&gt;&lt;P&gt;NOTE 485-185: Informat YEAR was not found or could not be loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand why I get this error. Is there a different method I could be using? My code is shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Convert fiscyear to date format */&lt;/P&gt;&lt;P&gt;data work.project_new (drop=fiscyear);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set WORK.project_old;&lt;/P&gt;&lt;P&gt;&amp;nbsp; charyear = put(fiscyear,4.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.project_new (drop=charyear);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set work.project_new;&lt;/P&gt;&lt;P&gt;&amp;nbsp; fiscyear = input(charyear,year4.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; format fiscyear year4.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 22:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-year-to-a-date-formatted-year/m-p/177800#M264840</guid>
      <dc:creator>klappy711</dc:creator>
      <dc:date>2014-07-13T22:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a numeric year to a date formatted year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-year-to-a-date-formatted-year/m-p/177801#M264841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error occurs in the statement: &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; fiscyear = input(charyear,year4.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Is this because year4. is not an acceptable informat?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 22:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-year-to-a-date-formatted-year/m-p/177801#M264841</guid>
      <dc:creator>klappy711</dc:creator>
      <dc:date>2014-07-13T22:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a numeric year to a date formatted year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-year-to-a-date-formatted-year/m-p/177802#M264842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are trying to use YEAR as an INFORMAT, when it only exists in SAS as a FORMAT. This means it will only work when you already have a SAS date and you apply it with a PUT function or FORMAT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fiscyear = mdy(1, 1, input(charyear, 4.));&lt;/P&gt;&lt;P&gt;format fiscyear year4.; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To create a SAS date you also need to tell SAS the day and the month of your date, so that fiscyear actually stores 1 Jan 2014, for example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2014 00:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-year-to-a-date-formatted-year/m-p/177802#M264842</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2014-07-14T00:11:18Z</dc:date>
    </item>
  </channel>
</rss>

