<?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: Shifting a datetime value by a number of years in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389933#M93496</link>
    <description>&lt;P&gt;That does not work. When I try newdob = intnx("year", dob, -60) all I get is 1/1/1960. Plus, I need the time portion to remain stable.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2017 17:27:02 GMT</pubDate>
    <dc:creator>DocMartin</dc:creator>
    <dc:date>2017-08-22T17:27:02Z</dc:date>
    <item>
      <title>Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389924#M93494</link>
      <description>&lt;P&gt;I received a dataset in which many of the observations have a datetime value where the year is 2076 or 2077. Obviously these values are off by 60 years. So how can I modify the year value in that datetime variable so that the right year is in there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ex. DOB = 02/15/2076 13:00 should be 02/15/2016 13:00&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DOB = 05/26/2077 9:35 should be 05/26/2017 9:35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 17:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389924#M93494</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2017-08-22T17:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389925#M93495</link>
      <description>&lt;P&gt;Use INTNX.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 17:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389925#M93495</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-22T17:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389933#M93496</link>
      <description>&lt;P&gt;That does not work. When I try newdob = intnx("year", dob, -60) all I get is 1/1/1960. Plus, I need the time portion to remain stable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 17:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389933#M93496</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2017-08-22T17:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389935#M93497</link>
      <description>&lt;P&gt;You stated you had a datetime variable? If so, then Year is not the correct interval, it's DTYEAR I think. For the remaining values to be the same use the fourth parameter which controls the alignment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newdob = intnx("dtyear", dob, -60, 's')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 17:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389935#M93497</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-22T17:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389936#M93498</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83350"&gt;@DocMartin&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;That does not work. When I try newdob = intnx("year", dob, -60) all I get is 1/1/1960. Plus, I need the time portion to remain stable.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have a datetime value, not a date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use&lt;/P&gt;
&lt;PRE&gt;intnx("dtyear",dob,-60)&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Aug 2017 17:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389936#M93498</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-22T17:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389937#M93499</link>
      <description>&lt;P&gt;Did you import this data from Excel originally?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 17:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389937#M93499</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-22T17:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389944#M93501</link>
      <description>Yes, unfortunately.</description>
      <pubDate>Tue, 22 Aug 2017 17:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389944#M93501</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2017-08-22T17:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting a datetime value by a number of years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389962#M93505</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83350"&gt;@DocMartin&lt;/a&gt; wrote:&lt;BR /&gt;Yes, unfortunately.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Assuming this means you did import it from Excel, then I would suggest an approach noted here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Integration-with-Microsoft/Importing-date-time-variables-from-Excel-into-SAS/td-p/129881" target="_blank"&gt;https://communities.sas.com/t5/Integration-with-Microsoft/Importing-date-time-variables-from-Excel-into-SAS/td-p/129881&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's a specific value that you need to use to account for Excel date to SAS date but I can't remember the rule, if you're sure it's 60 years this appraoch will work though.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 18:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shifting-a-datetime-value-by-a-number-of-years/m-p/389962#M93505</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-22T18:18:57Z</dc:date>
    </item>
  </channel>
</rss>

