<?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 change specific year in the date variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276388#M269635</link>
    <description>&lt;P&gt;Should all the dates be 2014? &amp;nbsp;If not, how do you know what to change and what to change it to? &amp;nbsp;One example isn't enough to illustrate the changes that need to be made.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2016 01:17:59 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-06-10T01:17:59Z</dc:date>
    <item>
      <title>How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276381#M269632</link>
      <description>&lt;P&gt;Hi ! I have this date variable in my dataset. Some of the year in the date is wrong and I want to change it. For instance, some of the date value has year 2074, but I want to change it to 2014. Is there anyway I can do that? Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 23:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276381#M269632</guid>
      <dc:creator>psychopedia</dc:creator>
      <dc:date>2016-06-09T23:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276383#M269633</link>
      <description>&lt;P&gt;The easiest way to change the year&amp;nbsp;portion of a date is with by using the intnx function&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm" target="_self"&gt;intnx function reference&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use negative values for the increment as well as positive ones.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 00:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276383#M269633</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2016-06-10T00:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276386#M269634</link>
      <description>&lt;P&gt;Sure, what&amp;nbsp;does your variable look like, is it a SAS date?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if year(date)=2074 then date=mdy(month(date), day(date), 2014);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Jun 2016 00:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276386#M269634</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-10T00:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276388#M269635</link>
      <description>&lt;P&gt;Should all the dates be 2014? &amp;nbsp;If not, how do you know what to change and what to change it to? &amp;nbsp;One example isn't enough to illustrate the changes that need to be made.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 01:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276388#M269635</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-10T01:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276389#M269636</link>
      <description>&lt;P&gt;some of the date is 2074, which should be 2014. The date has the date9. format&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 01:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276389#M269636</guid>
      <dc:creator>psychopedia</dc:creator>
      <dc:date>2016-06-10T01:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276390#M269637</link>
      <description>&lt;P&gt;It has a date9. format. I tried your method first, but the error shows&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Undeclared array referenced: year.&lt;BR /&gt;ERROR: Variable year has not been declared as an array&lt;/P&gt;&lt;P&gt;for some reason.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 01:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276390#M269637</guid>
      <dc:creator>psychopedia</dc:creator>
      <dc:date>2016-06-10T01:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276392#M269638</link>
      <description>&lt;P&gt;Assuming your date variables are actually SAS dates this is one way.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  if year(date) = 2074 then date=mdy(month(date), day(date),2014);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The MDY function builds a SAS date value from a month, day of month and year. The functions Month and Day give you those bits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 01:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276392#M269638</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-10T01:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276394#M269639</link>
      <description>&lt;P&gt;Post your code and log as well as&amp;nbsp;a proc contents from your dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 01:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276394#M269639</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-10T01:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276395#M269640</link>
      <description>&lt;P&gt;Just in case you find other cases ... maybe 2073 should become 2013 ... this might be a little more generalizable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if year(date) = 2074 then date = intnx('year', date, -60, 'same');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If 2073 should be 2013, you could change just the IF condition:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if year(date) in (2013, 2014) then ...&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 01:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276395#M269640</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-10T01:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276403#M269641</link>
      <description>&lt;P&gt;I think the only way to get that error is to use brackets [] or braces {} instead of parentheses () to call function Year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if year[date] = 2074 then ...&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 02:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276403#M269641</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-10T02:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276405#M269642</link>
      <description>&lt;P&gt;The 60 year difference probably occurs as a result of an import from Excel or MS-Access. The reference date in MS-Office is Jan 01 1900 (which has value = 1) and is Jan 01 1960 in SAS (which has value = 0). The difference between the two systems is actually 60 years and one day (a difference in value of 21916). You should thus use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;correctDate = ExcelDate - 21916;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 03:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276405#M269642</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-10T03:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to change specific year in the date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276426#M269643</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88563"&gt;@psychopedia&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;It has a date9. format. I tried your method first, but the error shows&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Undeclared array referenced: year.&lt;BR /&gt;ERROR: Variable year has not been declared as an array&lt;/P&gt;
&lt;P&gt;for some reason.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then show your code and the portion of the log including the code.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 05:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-specific-year-in-the-date-variable/m-p/276426#M269643</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-06-10T05:44:10Z</dc:date>
    </item>
  </channel>
</rss>

