<?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 Date to SAS date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671851#M201811</link>
    <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In one table I have a date field called "DATE" that shows up as 20160401. It is type numeric formatted YYMMDDn8.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my second table I have a date field called "DATE2" that shows up as 20545 (a SAS date) which is type numeric with no format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to join these tables together by customer name (in both tables) and the date fields but I am struggling to convert the dates into similar format before the join. Is there an easy way to convert the YYMMDDn8. and convert it to a SAS date? Perhaps that idea is making this more complicated?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jul 2020 15:04:17 GMT</pubDate>
    <dc:creator>anweinbe</dc:creator>
    <dc:date>2020-07-23T15:04:17Z</dc:date>
    <item>
      <title>Date to SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671851#M201811</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In one table I have a date field called "DATE" that shows up as 20160401. It is type numeric formatted YYMMDDn8.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my second table I have a date field called "DATE2" that shows up as 20545 (a SAS date) which is type numeric with no format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to join these tables together by customer name (in both tables) and the date fields but I am struggling to convert the dates into similar format before the join. Is there an easy way to convert the YYMMDDn8. and convert it to a SAS date? Perhaps that idea is making this more complicated?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 15:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671851#M201811</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-07-23T15:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Date to SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671852#M201812</link>
      <description>&lt;P&gt;From your description no conversion is needed, both variable have the number of days since 1960.&amp;nbsp; The reason the values look different to you is just because they are being displayed using different formats. YYMMDD vs BEST.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 15:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671852#M201812</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-23T15:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Date to SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671856#M201813</link>
      <description>&lt;P&gt;Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I should be ignoring what fields visually looked like when they are dates and SAS will take care of it? Pardon the ignorance here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 15:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671856#M201813</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-07-23T15:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Date to SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671875#M201816</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;Yes, in your example that is true. The format on the DATE variable just changes the appearance of the variable when output, it's still stored as a numeric (number of days from 1 Jan 1960).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a simple example that might help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
	date=today() ;
	date2=today() ;
	format date date7. ;
	put "date: " date "date2: " date2;
	if date=date2 then
		put "date = date2 even if they appear different" ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 16:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671875#M201816</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2020-07-23T16:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date to SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671902#M201831</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 17:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-SAS-date/m-p/671902#M201831</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-23T17:34:19Z</dc:date>
    </item>
  </channel>
</rss>

