<?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 formatting year? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118672#M293281</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I feel crazy for asking this question but what worked last week is not working this week for some reason&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following data have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;14MAR2004&lt;/P&gt;&lt;P&gt;16MAR2005&lt;/P&gt;&lt;P&gt;11MAR2006&lt;/P&gt;&lt;P&gt;22MAR2007&lt;/P&gt;&lt;P&gt;02MAR2008&lt;/P&gt;&lt;P&gt;19MAR2009&lt;/P&gt;&lt;P&gt;11MAR2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to create a "year" column from these date which will be equal to the year of the date plus one (for example, for 14MAR2004 the year would be 2005)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I have used the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want; set have;&lt;/P&gt;&lt;P&gt;year= year(date) + 1;&lt;/P&gt;&lt;P&gt;format year year4.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has returned the desired year but this morning sas is returning 1965 as the year value for each date value in the column. Am I missing something? The date value has been previously formatted as date9.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Jan 2013 17:24:02 GMT</pubDate>
    <dc:creator>chappy</dc:creator>
    <dc:date>2013-01-08T17:24:02Z</dc:date>
    <item>
      <title>formatting year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118672#M293281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I feel crazy for asking this question but what worked last week is not working this week for some reason&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following data have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;14MAR2004&lt;/P&gt;&lt;P&gt;16MAR2005&lt;/P&gt;&lt;P&gt;11MAR2006&lt;/P&gt;&lt;P&gt;22MAR2007&lt;/P&gt;&lt;P&gt;02MAR2008&lt;/P&gt;&lt;P&gt;19MAR2009&lt;/P&gt;&lt;P&gt;11MAR2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to create a "year" column from these date which will be equal to the year of the date plus one (for example, for 14MAR2004 the year would be 2005)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I have used the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want; set have;&lt;/P&gt;&lt;P&gt;year= year(date) + 1;&lt;/P&gt;&lt;P&gt;format year year4.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has returned the desired year but this morning sas is returning 1965 as the year value for each date value in the column. Am I missing something? The date value has been previously formatted as date9.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2013 17:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118672#M293281</guid>
      <dc:creator>chappy</dc:creator>
      <dc:date>2013-01-08T17:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: formatting year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118673#M293282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check your yearcutoff option setting and run a proc contents on your dataset and look at the format and type of your date variable. Make sure its date not datetime. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Old but still relevant for yearcutoff option:&lt;/P&gt;&lt;P&gt;&lt;A href="http://ftp.sas.com/service/techsup/tsnews-l/0040.html" title="http://ftp.sas.com/service/techsup/tsnews-l/0040.html"&gt;SAS Technical Support News: A GUIDE TO THE YEARCUTOFF= OPTION&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2013 17:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118673#M293282</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-08T17:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: formatting year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118674#M293283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Remove the statement that declares the year format for variable year.&amp;nbsp; The year format expects a date, not a year.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2013 17:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118674#M293283</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-01-08T17:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: formatting year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118675#M293284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza. I used&amp;nbsp; "options yearcutoff=1920;"&amp;nbsp;&amp;nbsp; before the data statement and it worked. The date variable was already formatted to date9. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2013 18:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118675#M293284</guid>
      <dc:creator>chappy</dc:creator>
      <dc:date>2013-01-08T18:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: formatting year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118676#M293285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would do it this way :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;format date date9.;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;input date :date9.;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;14MAR2004&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;16MAR2005&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;11MAR2006&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;22MAR2007&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;02MAR2008&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;19MAR2009&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;11MAR2010&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;data want; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;yearDate = intnx("YEAR", date, 1); /* move date by 1 year */&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;format yearDate year4.;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;proc print; run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if your dates are in fact datetimes then replace "YEAR" by "DTYEAR" and year4. by dtyear4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2013 18:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-year/m-p/118676#M293285</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-01-08T18:08:22Z</dc:date>
    </item>
  </channel>
</rss>

