<?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 DateTime formatting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981490#M379131</link>
    <description>&lt;P&gt;I have a 3 numeric datetime columns with the format DateTime. When I export the SAS data into EXCEL the year of the column for 2026 is showing as 1926. How can i fix this? What I am doing wrong. Thanks in advance&lt;/P&gt;&lt;P&gt;1/1/2026 12:54 is showing up in EXCEL as 1/1/1926 12:54&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jan 2026 17:57:34 GMT</pubDate>
    <dc:creator>AMFR</dc:creator>
    <dc:date>2026-01-05T17:57:34Z</dc:date>
    <item>
      <title>DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981490#M379131</link>
      <description>&lt;P&gt;I have a 3 numeric datetime columns with the format DateTime. When I export the SAS data into EXCEL the year of the column for 2026 is showing as 1926. How can i fix this? What I am doing wrong. Thanks in advance&lt;/P&gt;&lt;P&gt;1/1/2026 12:54 is showing up in EXCEL as 1/1/1926 12:54&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2026 17:57:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981490#M379131</guid>
      <dc:creator>AMFR</dc:creator>
      <dc:date>2026-01-05T17:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981491#M379132</link>
      <description>&lt;P&gt;Check your YEARCUTOFF setting -- it might be set to 1926.&amp;nbsp;&lt;BR /&gt;See:&amp;nbsp;&lt;LI-MESSAGE title="YEARCUTOFF option setting for SAS Viya 3.5 and older SAS 9.4 releases" uid="981430" url="https://communities.sas.com/t5/Administration-and-Deployment/YEARCUTOFF-option-setting-for-SAS-Viya-3-5-and-older-SAS-9-4/m-p/981430#U981430" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2026 18:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981491#M379132</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2026-01-05T18:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981492#M379133</link>
      <description>&lt;P&gt;If you have a date-time variable in a SAS dataset, and you're exporting the data to Excel, I don't see how Excel could end up with a value that is 100 years off.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it's hard to guess at what might be going wrong without more info.&amp;nbsp; Can you show the code for how you export the data to Excel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you post example data that replicates the problem?&amp;nbsp; For example, if you export the below dataset, do you see the problem?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  mydate="01Jan2026:12:54"dt ;
  format mydate datetime19. ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think it's most likely that the date-time value in your SAS dataset is actually&amp;nbsp;&lt;SPAN&gt;1/1/1926 12:54, due to a problem earlier in your code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2026 18:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981492#M379133</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-01-05T18:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981495#M379134</link>
      <description>&lt;P&gt;In&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;'s reply he includes a hint, which is that a fully qualified SAS format can make the difference. DATETIME is not the same as DATETIME19, and your data might be using the former -- which could leave it vulnerable to a YEARCUTOFF ambiguity when the formatted date value is exported.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChrisHemedinger_0-1767638413082.png" style="width: 815px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112476i2BC8511FCACC72AE/image-dimensions/815x156?v=v2" width="815" height="156" role="button" title="ChrisHemedinger_0-1767638413082.png" alt="ChrisHemedinger_0-1767638413082.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2026 18:41:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981495#M379134</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2026-01-05T18:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981608#M379151</link>
      <description>As Quentin said, it is hard to give you some advice before you posted an example to replicate your issue.&lt;BR /&gt;Post your sample data and the code you are using.</description>
      <pubDate>Wed, 07 Jan 2026 07:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981608#M379151</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-01-07T07:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981609#M379152</link>
      <description>Please provide the complete log of the export step, and also tell us which format is assigned to the datetime variable. If it is a custom format, do also supply the PROC FORMAT code.</description>
      <pubDate>Wed, 07 Jan 2026 08:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981609#M379152</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2026-01-07T08:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981650#M379163</link>
      <description>&lt;P&gt;Yes the YEARCUTOFF setting was 1926.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After changing it to 1940, EXCEL is giving me year as 2026.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 18:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981650#M379163</guid>
      <dc:creator>AMFR</dc:creator>
      <dc:date>2026-01-07T18:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981651#M379164</link>
      <description>&lt;P&gt;Thank you. Next time I will post the codes as well.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 18:06:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981651#M379164</guid>
      <dc:creator>AMFR</dc:creator>
      <dc:date>2026-01-07T18:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981652#M379165</link>
      <description>&lt;P&gt;Glad you got it working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect the problem was actually in your SAS dataset, not in the process of exporting the data to Excel.&amp;nbsp; Can you share how you exported the data to Excel?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My understanding is the yearcutoff option only has an effect when SAS encounters a two-digit value and is asked to interpret it as a four-digit year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have a date variable (or date-time variable), the data is stored as a number (number of days or seconds since 01Jan1960).&amp;nbsp; So yearcutoff should not have any impact, as I understand it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run below, the date-time is correctly exported to Excel, as I would expect:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options yearcutoff=1926 ;

data have ;
  mydate="01Jan2026:12:54"dt ;
  format mydate datetime. ;
run ;

proc export data=have outfile="Q:\junk\want.xlsx" dbms=xlsx replace;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My guess is if changing yearcutoff fixed the problem, that means somewhere in your code or data you have a two-digit year and you asked SAS to calculate a date-time from that value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;, is there really a case where the YEARCUTOFF value would effect the export process itself (assuming the exported data is a SAS date or date-time)?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 18:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981652#M379165</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-01-07T18:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: DateTime formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981704#M379179</link>
      <description>&lt;P&gt;I cannot say for sure,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. Since there are many ways to "export" to Excel (in UIs and code engines), it's possible that some methods would use the formatted value and if that featured a 2-digit year, then YEARCUTOFF could play a part. So...better to have a fully qualified format plus a reasonable setting for YEARCUTOFF!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 14:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DateTime-formatting/m-p/981704#M379179</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2026-01-08T14:57:33Z</dc:date>
    </item>
  </channel>
</rss>

