<?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: How to display the current year in character data type in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64671#M18377</link>
    <description>They are not equivalent.  The YEARw. (you used YEAR4.) format takes a SAS DATE variable and displays the year-portion.  So, your code took the SAS numeric variable value 2009 (which represents the date 19MAY1965) and displayed only the year for that date.&lt;BR /&gt;
&lt;BR /&gt;
Also, the YEAR() function takes a SAS DATE numeric variable and extracts the year-portion, assigning the value to a variable, as you used it.&lt;BR /&gt;
&lt;BR /&gt;
The link below provides useful SAS Base DOC reference on this topic.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Dates, Times, and Intervals&lt;BR /&gt;
About SAS Date, Time, and Datetime Values&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm&lt;/A&gt;</description>
    <pubDate>Mon, 17 Aug 2009 03:13:42 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-08-17T03:13:42Z</dc:date>
    <item>
      <title>How to display the current year in character data type</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64666#M18372</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have encountered a problem in sas data integration studio which has been bugging me for some time.&lt;BR /&gt;
&lt;BR /&gt;
I have a column called year which is a derived dated field that shows the current year.&lt;BR /&gt;
&lt;BR /&gt;
Then i encountered a strange thing&lt;BR /&gt;
&lt;BR /&gt;
if my column is a numeric data type and i do this -&amp;gt; YEAR(Date()) -&amp;gt; I get 2009&lt;BR /&gt;
&lt;BR /&gt;
if my column is a character data type and i do this -&amp;gt; PUT(YEAR(Date(), year4.) -&amp;gt; I get 1965&lt;BR /&gt;
&lt;BR /&gt;
It's so strange, so I like to find out how can I displayed 2009 in character data type?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
Yours Sincerely,&lt;BR /&gt;
helphelp</description>
      <pubDate>Fri, 14 Aug 2009 08:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64666#M18372</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-14T08:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to display the current year in character data type</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64667#M18373</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Try This&lt;BR /&gt;
&lt;BR /&gt;
in place of &lt;BR /&gt;
PUT(YEAR(Date(), year4.) &lt;BR /&gt;
&lt;BR /&gt;
keep&lt;BR /&gt;
put(year(date),4.);</description>
      <pubDate>Fri, 14 Aug 2009 09:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64667#M18373</guid>
      <dc:creator>LOK</dc:creator>
      <dc:date>2009-08-14T09:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to display the current year in character data type</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64668#M18374</link>
      <description>It's not strange&lt;BR /&gt;
&lt;BR /&gt;
YEAR(Date()) will return 2009 as you write&lt;BR /&gt;
&lt;BR /&gt;
But PUT(YEAR(Date()), year4.)&lt;BR /&gt;
&lt;BR /&gt;
is the same as &lt;BR /&gt;
&lt;BR /&gt;
PUT(2009,year4.)&lt;BR /&gt;
&lt;BR /&gt;
Remember that year4. will display the year that is 2009 DAYS since 1960 - and 1965 is 2009 DAYS since 1960. &lt;BR /&gt;
&lt;BR /&gt;
Just use PUT(date(), year4.)</description>
      <pubDate>Fri, 14 Aug 2009 09:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64668#M18374</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2009-08-14T09:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to display the current year in character data type</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64669#M18375</link>
      <description>Hi,&lt;BR /&gt;
you cen use any one of the following&lt;BR /&gt;
&lt;BR /&gt;
PUT(YEAR(DATE), 4.)&lt;BR /&gt;
&lt;BR /&gt;
PUT(DATE, YEAR4.)</description>
      <pubDate>Fri, 14 Aug 2009 09:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64669#M18375</guid>
      <dc:creator>LOK</dc:creator>
      <dc:date>2009-08-14T09:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to display the current year in character data type</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64670#M18376</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the people out there that is helping me&lt;BR /&gt;
&lt;BR /&gt;
one last clarification &lt;BR /&gt;
&lt;BR /&gt;
PUT(YEAR(Date()) , year4.) return '1965'&lt;BR /&gt;
&lt;BR /&gt;
PUT(YEAR(Date()), 4.) return '2009'&lt;BR /&gt;
&lt;BR /&gt;
are there actually equivalent?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Yours Sincerely,&lt;BR /&gt;
helphelp</description>
      <pubDate>Mon, 17 Aug 2009 01:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64670#M18376</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-17T01:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to display the current year in character data type</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64671#M18377</link>
      <description>They are not equivalent.  The YEARw. (you used YEAR4.) format takes a SAS DATE variable and displays the year-portion.  So, your code took the SAS numeric variable value 2009 (which represents the date 19MAY1965) and displayed only the year for that date.&lt;BR /&gt;
&lt;BR /&gt;
Also, the YEAR() function takes a SAS DATE numeric variable and extracts the year-portion, assigning the value to a variable, as you used it.&lt;BR /&gt;
&lt;BR /&gt;
The link below provides useful SAS Base DOC reference on this topic.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Dates, Times, and Intervals&lt;BR /&gt;
About SAS Date, Time, and Datetime Values&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm&lt;/A&gt;</description>
      <pubDate>Mon, 17 Aug 2009 03:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-display-the-current-year-in-character-data-type/m-p/64671#M18377</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-17T03:13:42Z</dc:date>
    </item>
  </channel>
</rss>

