<?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 Full Join using proc sql but not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650001#M194907</link>
    <description>&lt;P&gt;Hi, I am trying to perform a full join using two tables, there is no output on the log; my SAS server just seems to be timing out. Not sure what is happening or how to troubleshoot this issue. Here is my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET start_date = 01JAN20:12:00: 00.000000;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table uat as&lt;BR /&gt;select x.sku_id, x.Base_Price_Amt, xx.On_Air_Qty,&lt;BR /&gt;y.Shipping_And_Handling_Amt, y.Source_Cd&lt;BR /&gt;from hist x full join expos y on (x.sku_id = y.sku_id)&lt;BR /&gt;where x.Valid_Start_Dttm between "&amp;amp;start_date."d and today() - 1&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Fri, 22 May 2020 20:01:49 GMT</pubDate>
    <dc:creator>ngrannum75</dc:creator>
    <dc:date>2020-05-22T20:01:49Z</dc:date>
    <item>
      <title>Full Join using proc sql but not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650001#M194907</link>
      <description>&lt;P&gt;Hi, I am trying to perform a full join using two tables, there is no output on the log; my SAS server just seems to be timing out. Not sure what is happening or how to troubleshoot this issue. Here is my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET start_date = 01JAN20:12:00: 00.000000;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table uat as&lt;BR /&gt;select x.sku_id, x.Base_Price_Amt, xx.On_Air_Qty,&lt;BR /&gt;y.Shipping_And_Handling_Amt, y.Source_Cd&lt;BR /&gt;from hist x full join expos y on (x.sku_id = y.sku_id)&lt;BR /&gt;where x.Valid_Start_Dttm between "&amp;amp;start_date."d and today() - 1&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 20:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650001#M194907</guid>
      <dc:creator>ngrannum75</dc:creator>
      <dc:date>2020-05-22T20:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Full Join using proc sql but not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650027#M194909</link>
      <description>&lt;P&gt;You have an&amp;nbsp;&lt;EM&gt;incorrectly written&amp;nbsp;&lt;STRONG&gt;datetime&lt;/STRONG&gt;&lt;/EM&gt; value which you try to use as a&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;date&lt;/STRONG&gt;&lt;/EM&gt; literal.&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 21:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650027#M194909</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-22T21:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Full Join using proc sql but not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650030#M194910</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS EG. How do you suggest I correct this variable? In the table uses this datetime format and i would like to filter for a specific date range. is my macro incorrect or my where clause?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Valid_Start_Dttm&amp;nbsp;&lt;/P&gt;&lt;P&gt;"01JAN2020:12:00:00.000000"d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET start_date = 01JAN2020:12:00:00.000000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where x.Valid_Start_Dttm BETWEEN "&amp;amp;start_date."d AND TODAY()- 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am guessing I would need a datetime in my where clause?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 21:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650030#M194910</guid>
      <dc:creator>ngrannum75</dc:creator>
      <dc:date>2020-05-22T21:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Full Join using proc sql but not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650038#M194911</link>
      <description>&lt;P&gt;Dates are stored as the number of DAYS since 1960. Datetimes are stored as the number of SECONDS since 1960.&amp;nbsp; So unless your DATETIME values are very early in the date 01JAN1960 they will never be between any two DATE values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a DATETIME literal by appending DT instead of just D to the quoted string that the DATETIME informat can interpret.&amp;nbsp; Make sure to use a DATETIME value for the upper bound of your interval also.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where x.Valid_Start_Dttm BETWEEN "&amp;amp;start_date."dt AND intnx('dtday',datetime(),-1)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or since it appears you don't really care about the time of day part of the datetime variable, convert it from seconds to days.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where datepart(x.Valid_Start_Dttm) BETWEEN datepart("&amp;amp;start_date."dt) AND today()-1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;On source of confusion is that SAS is not going to throw an error when you give it extra characters in your date literal.&amp;nbsp; So SAS will happily treat these two things as the same number of days without any error or warning.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"01JAN2020:12:00:00.000000"d
"01JAN2020"d&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 May 2020 21:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650038#M194911</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-05-22T21:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Full Join using proc sql but not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650039#M194912</link>
      <description>Thank you so much! This clears up my confusion!</description>
      <pubDate>Fri, 22 May 2020 21:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Full-Join-using-proc-sql-but-not-working/m-p/650039#M194912</guid>
      <dc:creator>ngrannum75</dc:creator>
      <dc:date>2020-05-22T21:58:42Z</dc:date>
    </item>
  </channel>
</rss>

