<?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: Date formats in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58683#M6017</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the DATEPART() function to get just the date value from a datetime field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if you are pulling this from Oracle, you might want to create your filtered subset first, based on the unaltered datetime values.&amp;nbsp; Then, when the subset is in SAS, you can manipulate the datetime fields further with a second query that calculates what you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why two steps?&amp;nbsp; Well, not all SAS function constructs can pass down to the Oracle database.&amp;nbsp; If you build a filter that is based on a SAS function (such as DATEPART or INTNX), SAS might be forced to bring *more* of the Oracle rows into SAS to perform the function and evaluate the filter.&amp;nbsp; If you can express the first-pass filter in a way that Oracle can process, then you'll get a smaller result set into SAS in a more efficient way.&amp;nbsp; Once the results are in SAS, SAS functions can execute very quickly without having to move a lot of records around.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Apr 2012 13:05:33 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2012-04-09T13:05:33Z</dc:date>
    <item>
      <title>Date formats</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58682#M6016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have some date fields in an Oracle table that I am trying to filter on in Enterprise Guide 4.1.&amp;nbsp; The dates come in with date and time.&amp;nbsp; I want to reformat the fields (maybe create a new column) to get rid of the time portion of the date field.&amp;nbsp; I don't know the syntax to do this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The filtering on the date field goes something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eff_frm_Dt &amp;lt;= current date&lt;/P&gt;&lt;P&gt;Eff_to_Dt is missing or eff_to_Dt &amp;gt;= current date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For current date I have been using intnx('day',date(),0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the above filter on the date fields, I get no results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I remove the filtering, I get results but I need to be able to filter on the dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the date comes in as date and time, I thought I should reformat the date field to remove the time portion creating new columns.&amp;nbsp; Then use those columns to filter on.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 12:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58682#M6016</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-09T12:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Date formats</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58683#M6017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the DATEPART() function to get just the date value from a datetime field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if you are pulling this from Oracle, you might want to create your filtered subset first, based on the unaltered datetime values.&amp;nbsp; Then, when the subset is in SAS, you can manipulate the datetime fields further with a second query that calculates what you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why two steps?&amp;nbsp; Well, not all SAS function constructs can pass down to the Oracle database.&amp;nbsp; If you build a filter that is based on a SAS function (such as DATEPART or INTNX), SAS might be forced to bring *more* of the Oracle rows into SAS to perform the function and evaluate the filter.&amp;nbsp; If you can express the first-pass filter in a way that Oracle can process, then you'll get a smaller result set into SAS in a more efficient way.&amp;nbsp; Once the results are in SAS, SAS functions can execute very quickly without having to move a lot of records around.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 13:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58683#M6017</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2012-04-09T13:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Date formats</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58684#M6018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What would be the syntax for DatePart?&amp;nbsp; I am not sure I follow you on the following:&lt;/P&gt;&lt;P&gt;"you might want to create your filtered subset first, based on the unaltered datetime values."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't create the filtered subset since filtering on the dates does not work.&amp;nbsp;&amp;nbsp; That is the reason for my question.&amp;nbsp; I thought maybe it was because the dates have a time attached.&amp;nbsp; Maybe if I try to get rid of the time, I can filter on the dates.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 13:15:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58684#M6018</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-09T13:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Date formats</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58685#M6019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To filter on some datetime values, try the literal syntax such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Eff_frm_Dt&lt;/SPAN&gt; BETWEEN '01MAR2012:00:00:00'dt AND&amp;nbsp; '09APR2012:00:00:00'dt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the DATEPART function first and apply a format at the same time, you could calculate a new column:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT Eff_frm_Dt, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* justdate */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (datepart(Eff_frm_Dt)) FORMAT=date9. AS justdate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then build your filters based on the new column JUSTDATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 13:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58685#M6019</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2012-04-09T13:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date formats</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58686#M6020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Since your target variable is a DATETIME value, try creating your filter with a DATETIME value as well.&amp;nbsp; Rather than use "current_date", create a variable named "current_time" set to just before midnight:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;current_time = input(put(current_date,date9.) || ':23:59:59';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 13:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58686#M6020</guid>
      <dc:creator>BobD</dc:creator>
      <dc:date>2012-04-09T13:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Date formats</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58687#M6021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got it to work.&amp;nbsp; I created two calculated columns using DatePart.&amp;nbsp; Then I formated each calculated column with a date format.&amp;nbsp; Then I used those calculated columns to filter on. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EfffrmDt&amp;lt;=intnx('day',date(),0)&lt;/P&gt;&lt;P&gt;(EfftoDt is missing or EfftoDt &amp;gt;= intnx('day',date(),0))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 14:07:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-formats/m-p/58687#M6021</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-09T14:07:02Z</dc:date>
    </item>
  </channel>
</rss>

