<?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 How to left join two tables using dates(informat YYMMDD10. &amp;amp; ANYDTDTM40.) in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-left-join-two-tables-using-dates-informat-YYMMDD10-amp/m-p/823564#M41101</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS EG 8.3 and I'm trying to do a left join between two tables using dates and a proc sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One table has a date variable with these properties:&lt;/P&gt;&lt;P&gt;Type: Numeric&lt;/P&gt;&lt;P&gt;Group: Date&lt;/P&gt;&lt;P&gt;Format: YYMMDD10.&lt;/P&gt;&lt;P&gt;Informat: YYMMDD10.&lt;/P&gt;&lt;P&gt;Values are displayed like this: 2023-09-15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other table has a date variable with these properties:&lt;/P&gt;&lt;P&gt;Type: Numeric&lt;/P&gt;&lt;P&gt;Group: Date&lt;/P&gt;&lt;P&gt;Format: DATETIME.&lt;/P&gt;&lt;P&gt;Informat: ANYDTDTM40.&lt;/P&gt;&lt;P&gt;Values are displayed like this: 15Sep2023 0:00:00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone help me with the transformation I have to do to make this join happen?&lt;/P&gt;&lt;P&gt;Thank you very much!&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>Fri, 15 Jul 2022 18:20:47 GMT</pubDate>
    <dc:creator>x2PSx</dc:creator>
    <dc:date>2022-07-15T18:20:47Z</dc:date>
    <item>
      <title>How to left join two tables using dates(informat YYMMDD10. &amp; ANYDTDTM40.)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-left-join-two-tables-using-dates-informat-YYMMDD10-amp/m-p/823564#M41101</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS EG 8.3 and I'm trying to do a left join between two tables using dates and a proc sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One table has a date variable with these properties:&lt;/P&gt;&lt;P&gt;Type: Numeric&lt;/P&gt;&lt;P&gt;Group: Date&lt;/P&gt;&lt;P&gt;Format: YYMMDD10.&lt;/P&gt;&lt;P&gt;Informat: YYMMDD10.&lt;/P&gt;&lt;P&gt;Values are displayed like this: 2023-09-15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other table has a date variable with these properties:&lt;/P&gt;&lt;P&gt;Type: Numeric&lt;/P&gt;&lt;P&gt;Group: Date&lt;/P&gt;&lt;P&gt;Format: DATETIME.&lt;/P&gt;&lt;P&gt;Informat: ANYDTDTM40.&lt;/P&gt;&lt;P&gt;Values are displayed like this: 15Sep2023 0:00:00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone help me with the transformation I have to do to make this join happen?&lt;/P&gt;&lt;P&gt;Thank you very much!&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>Fri, 15 Jul 2022 18:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-left-join-two-tables-using-dates-informat-YYMMDD10-amp/m-p/823564#M41101</guid>
      <dc:creator>x2PSx</dc:creator>
      <dc:date>2022-07-15T18:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to left join two tables using dates(informat YYMMDD10. &amp; ANYDTDTM40.)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-left-join-two-tables-using-dates-informat-YYMMDD10-amp/m-p/823568#M41102</link>
      <description>&lt;P&gt;It would have been nice to have detail like variable names.&lt;/P&gt;
&lt;P&gt;You want to use the DATEPART function on the Datetime variable to pull the date for comparison with any date value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So and ON clause for a joint might look like:&lt;/P&gt;
&lt;PRE&gt;on a.datevariable = datepart(b.datetimevariable)&lt;/PRE&gt;
&lt;P&gt;if you want to match a specific time then you would add the time portion to the date which is easy with the DHMS function:&lt;/P&gt;
&lt;PRE&gt;on dhms(a.datevariable,12,15,0) = b.datetimevariable&lt;/PRE&gt;
&lt;P&gt;for example would match on the date plus when hour=12 and minutes=15 and seconds=0 in both variables.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 18:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-left-join-two-tables-using-dates-informat-YYMMDD10-amp/m-p/823568#M41102</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-15T18:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to left join two tables using dates(informat YYMMDD10. &amp; ANYDTDTM40.)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-left-join-two-tables-using-dates-informat-YYMMDD10-amp/m-p/823581#M41103</link>
      <description>The datepart function did the trick, thank you for your time ballardw!</description>
      <pubDate>Fri, 15 Jul 2022 20:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-left-join-two-tables-using-dates-informat-YYMMDD10-amp/m-p/823581#M41103</guid>
      <dc:creator>x2PSx</dc:creator>
      <dc:date>2022-07-15T20:58:43Z</dc:date>
    </item>
  </channel>
</rss>

