<?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: Code returns 1/1/1960 for input dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-returns-1-1-1960-for-input-dates/m-p/955255#M373079</link>
    <description>It's because you're doing literal math with those things that look like dates:&lt;BR /&gt;11/28/2017 is 11 divided by 28 divided by 2017.  You need to format the dates, e.g., like this:  "28Nov2017"d  -- SAS understands that as a date.  There are other ways too.</description>
    <pubDate>Mon, 06 Jan 2025 22:32:43 GMT</pubDate>
    <dc:creator>quickbluefish</dc:creator>
    <dc:date>2025-01-06T22:32:43Z</dc:date>
    <item>
      <title>Code returns 1/1/1960 for input dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-returns-1-1-1960-for-input-dates/m-p/955253#M373078</link>
      <description>&lt;P&gt;To begin with, I understand the basics of 1/1/1960 as the 'base' for all dates in SAS programming, so no need to elaborate on that.&lt;/P&gt;&lt;P&gt;What I don't understand is what my code is doing to change the dates back to that date from what I'm trying to input. Any guidance you may provide is greatly apprecated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA study; SET chart;&lt;/P&gt;&lt;P&gt;IF Sequence_No_ = 'A01-02' THEN DO;&lt;/P&gt;&lt;P&gt;Best = 2; Best_Date = 09/11/2017; Prog_Date = 09/11/2017;&lt;/P&gt;&lt;P&gt;END;&lt;BR /&gt;ELSE IF Sequence_No_ = 'A01-03' THEN DO;&lt;/P&gt;&lt;P&gt;Best = 2; Best_Date = 11/28/2017; Prog_Date = 11/28/2017; END;&lt;/P&gt;&lt;P&gt;FORMAT Best_Date MMDDYY.10 Prog_Date MMDDYY10.&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I get back is:&lt;/P&gt;&lt;P&gt;Sequence_No&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Best_Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Prog_Date&lt;/P&gt;&lt;P&gt;A01-02&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-01-1960&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01-01-1960&lt;/P&gt;&lt;P&gt;A01-03&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-01-1960&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01-01-1960&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, I get the significance of 1-1-1960. All I need is the correct code so that I get the dates I want. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 22:15:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-returns-1-1-1960-for-input-dates/m-p/955253#M373078</guid>
      <dc:creator>Newtrix</dc:creator>
      <dc:date>2025-01-06T22:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Code returns 1/1/1960 for input dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-returns-1-1-1960-for-input-dates/m-p/955255#M373079</link>
      <description>It's because you're doing literal math with those things that look like dates:&lt;BR /&gt;11/28/2017 is 11 divided by 28 divided by 2017.  You need to format the dates, e.g., like this:  "28Nov2017"d  -- SAS understands that as a date.  There are other ways too.</description>
      <pubDate>Mon, 06 Jan 2025 22:32:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-returns-1-1-1960-for-input-dates/m-p/955255#M373079</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-01-06T22:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Code returns 1/1/1960 for input dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-returns-1-1-1960-for-input-dates/m-p/955256#M373080</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Best_Date = 09/11/2017;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You do not assign a date here, but the result of a numeric expression: 9 divided by 11, then divided by 2017. This gives a very small number close to zero, which, when formatted as a date, will result in 1960-01-01.&lt;/P&gt;
&lt;P&gt;To supply dates in code, you must use valid&amp;nbsp;&lt;EM&gt;date literals&lt;/EM&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Best_Date = "09nov2017"d;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 22:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-returns-1-1-1960-for-input-dates/m-p/955256#M373080</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-01-06T22:34:17Z</dc:date>
    </item>
  </channel>
</rss>

