<?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: Today() doesnt work in where statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284325#M58023</link>
    <description>&lt;P&gt;HI Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the original date:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;where (DateCreated = '14jul2016:00:00:000'dt);&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jul 2016 13:33:39 GMT</pubDate>
    <dc:creator>pandhandj</dc:creator>
    <dc:date>2016-07-14T13:33:39Z</dc:date>
    <item>
      <title>Today() doesnt work in where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284308#M58018</link>
      <description>&lt;P&gt;Hi Guys, I'm new to SAS (EG 9.3) and very new here...please be gentle and use simple words!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have inherited some code that is ran each morning, with the date manually changed each day.&amp;nbsp; I want to automate this code, so i am trying to change the manual date to today(), so it doesn’t need any user input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i take the where...Today() statement out, i get all the dates, when i put it back in i don’t &amp;nbsp;get any observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for nay help given,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;paul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table work.alerts_daily as&lt;BR /&gt;&amp;nbsp; &amp;nbsp;select&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;intID,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;datecreated,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; description,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; subject,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SubjectEntity,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CustomerNumber&lt;BR /&gt;&amp;nbsp; &amp;nbsp;from table.alert&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; where description like 'Alert1' or description like 'Alert2' or description like 'Alert3';&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;create table LN_Alert_DAY&amp;nbsp;as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; select distinct a. *,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; b. Property&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;from work.alerts_daily as&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; a&amp;nbsp;inner join work.customer_status2 as b&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; on a. CustomerNumber = b. ID&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; order by intID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;create table work.LN_Alert_DT as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; select * from LN_Alert_DAY&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where Datecreated = today();&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 12:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284308#M58018</guid>
      <dc:creator>pandhandj</dc:creator>
      <dc:date>2016-07-14T12:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Today() doesnt work in where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284318#M58021</link>
      <description>&lt;P&gt;What did your manual date look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely the variable datecreated isn't a SAS date which is what you're expecting. It could either be a character variable or a date time variable. Check the variable type and format for the DateCreated variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 13:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284318#M58021</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-14T13:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Today() doesnt work in where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284325#M58023</link>
      <description>&lt;P&gt;HI Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the original date:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;where (DateCreated = '14jul2016:00:00:000'dt);&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 13:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284325#M58023</guid>
      <dc:creator>pandhandj</dc:creator>
      <dc:date>2016-07-14T13:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Today() doesnt work in where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284329#M58025</link>
      <description>&lt;P&gt;That's a date time variable, not a date variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the following instead of just today() to create a date time variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DateCreated = dhms(today(), 0, 0,0)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you could use datepart function to change dateCreated to a date variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Datepart(dateCreated)= today()&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 13:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284329#M58025</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-14T13:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Today() doesnt work in where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284332#M58027</link>
      <description>Woo! and Hoo!&lt;BR /&gt;&lt;BR /&gt;thats got it going,&lt;BR /&gt;&lt;BR /&gt;thanks very much Reeza.</description>
      <pubDate>Thu, 14 Jul 2016 13:46:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284332#M58027</guid>
      <dc:creator>pandhandj</dc:creator>
      <dc:date>2016-07-14T13:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Today() doesnt work in where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284371#M58043</link>
      <description>&lt;P&gt;Please mark&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;'s&amp;nbsp;answer as accepted.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 15:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Today-doesnt-work-in-where-statement/m-p/284371#M58043</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-14T15:32:21Z</dc:date>
    </item>
  </channel>
</rss>

