<?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: Where Date &amp;gt;= '01Jul2015'd not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/732093#M228108</link>
    <description>&lt;P&gt;Your date variable in data is in DATE9. informat. Use dhms function to make both sides of dates into same format. Then your where statement need to be changed as like this and then it should work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Where dhms(Date,0,0,0) &amp;gt;= dhms('01JUL2015'd,0,0,0);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Apr 2021 21:04:49 GMT</pubDate>
    <dc:creator>wilson</dc:creator>
    <dc:date>2021-04-07T21:04:49Z</dc:date>
    <item>
      <title>Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371209#M88666</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql;
	select datepart(round(disclosure_date,.1)) format date9.
	from core.bum_disclosure
	where  entity like 'Row%'
/*		and datepart(round(disclosure_date,.1)) &amp;gt;= '01Jul2015'd*/
 ;quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It retuns&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&lt;TABLE border="1" cellspacing="1" cellpadding="7"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;01SEP2016&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I&amp;nbsp;run same query&lt;/P&gt;&lt;PRE&gt;proc sql;
	select datepart(round(disclosure_date,.1)) format date9.
	from core.bum_disclosure
	where  entity like 'Row%'
		and datepart(round(disclosure_date,.1)) &amp;gt;= '01Jul2015'd
 ;quit;&lt;/PRE&gt;&lt;P&gt;It returns zero records. Why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 11:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371209#M88666</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2017-06-28T11:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371217#M88667</link>
      <description>&lt;P&gt;Well, question 1 is going to be why are you rounding a date?&lt;/P&gt;
&lt;P&gt;Second question is going to be "where is the test data in datastep form which we always ask for"&lt;/P&gt;
&lt;P&gt;The below works fine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  entity="Row1"; 
  disclosure_date="01SEP2016T00:10:00"dt;
run;
proc sql;
  create table want as 
	select datepart(disclosure_date) format date9.
	from have
	where  entity like 'Row%'
		and datepart(disclosure_date) &amp;gt;= '01Jul2015'd;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jun 2017 11:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371217#M88667</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-28T11:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371218#M88668</link>
      <description>&lt;P&gt;Please run&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table test as
	select entity, disclosure_date, datepart(round(disclosure_date,.1)) format date9.
	from core.bum_disclosure
	where  entity like 'Row%'
/*		and datepart(round(disclosure_date,.1)) &amp;gt;= '01Jul2015'd*/
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then use the macro from&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; to convert dataset test to a datastep and post that here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: added entity and disclosure_date in the select.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 11:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371218#M88668</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-28T11:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371493#M88746</link>
      <description>Even without rounding the problem occurs. I rounded up to zero decimal places because some years ago in this forum I encountered similar issue. For some reason there was a decimal in dates after importing.</description>
      <pubDate>Wed, 28 Jun 2017 23:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371493#M88746</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2017-06-28T23:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371494#M88747</link>
      <description>&lt;PRE&gt;data DT.TEST;
  infile datalines dsd truncover;
  input Entity:$255. Disclosure_Date:DATETIME20. _TEMA001:DATE9.;
datalines4;
ROW Asset,01SEP2016:00:00:00,01SEP2016
;;;;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 00:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371494#M88747</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2017-06-29T00:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371496#M88749</link>
      <description>&lt;P&gt;So that example data doesn't match the first part of the WHERE clause.&lt;/P&gt;
&lt;P&gt;ROW is not like 'Row%' since it has uppercase letters instead of lowercase letters.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 00:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371496#M88749</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-29T00:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371497#M88750</link>
      <description>&lt;P&gt;When I query core.bum_disclosure, CORE is an ODBC connect to&lt;STRONG&gt; Access 2013&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I export the data to SAS&lt;/P&gt;&lt;PRE&gt;data newclients;
set core.bum_disclosure;
run;&lt;/PRE&gt;&lt;P&gt;The same query in my first post run fine on work.newclients.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;So I will move on and attribute to something with my old SAS connector, I guess.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all for the quick help.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 00:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371497#M88750</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2017-06-29T00:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371498#M88751</link>
      <description>CORE is an ODBC connection to Access 2013. So 'Row%' do returns a record. And after I put an additional where condition for Disclosure_Date it does not return an record.</description>
      <pubDate>Thu, 29 Jun 2017 00:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371498#M88751</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2017-06-29T00:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371512#M88761</link>
      <description>&lt;P&gt;It looks like your external database is doing case insenstive comparisons on the variable ENTITY. But when you used the SAS specific functions DATEPART() and ROUND() then SAS could no longer push the WHERE clause into the database and so the LIKE clause ran on the SAS side instead where the comparison is case sensitive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just avoid using those functions? &amp;nbsp;If you want to compare to a specific datetime value use a datetime literal instead of a date literal.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select disclosure_date format=dtdate9.
from core.bum_disclosure
where entity like 'Row%'
  and disclosure_date &amp;gt;= '01Jul2015:00:00'dt
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 02:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/371512#M88761</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-29T02:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Where Date &gt;= '01Jul2015'd not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/732093#M228108</link>
      <description>&lt;P&gt;Your date variable in data is in DATE9. informat. Use dhms function to make both sides of dates into same format. Then your where statement need to be changed as like this and then it should work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Where dhms(Date,0,0,0) &amp;gt;= dhms('01JUL2015'd,0,0,0);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 21:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Date-gt-01Jul2015-d-not-working/m-p/732093#M228108</guid>
      <dc:creator>wilson</dc:creator>
      <dc:date>2021-04-07T21:04:49Z</dc:date>
    </item>
  </channel>
</rss>

