<?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: using proc sql to select by date one month back in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql-to-select-by-date-one-month-back/m-p/166134#M263765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's odd, the following program works fine for me.&amp;nbsp; note there is a typo in your code - dot before the entered_date.&amp;nbsp; Are you also sure the entered_date is a date variable?&amp;nbsp; Perhaps post test data where this fails?&lt;/P&gt;&lt;P&gt;data fulltable;&lt;BR /&gt;&amp;nbsp; entered_date="03MAR2014"d;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; entered_date="12NOV2014"d;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table RECENTAPPLICATION as&lt;BR /&gt;&amp;nbsp; select&amp;nbsp; * &lt;BR /&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; FULLTABLE &lt;BR /&gt;&amp;nbsp; where&amp;nbsp;&amp;nbsp; ENTERED_DATE &amp;gt; intnx("month",today(),-1);&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Nov 2014 16:43:17 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2014-11-11T16:43:17Z</dc:date>
    <item>
      <title>using proc sql to select by date one month back</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql-to-select-by-date-one-month-back/m-p/166133#M263764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all, I'm finding myself hitting a brick wall here and I'm sure it's silly.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table recentapplication as&lt;/P&gt;&lt;P&gt;select * from fulltable where&lt;/P&gt;&lt;P&gt;.entered_date &amp;gt;&amp;nbsp; intnx ( "month" , today() , -1 )&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's returning all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I change it to entered_date &amp;gt; today() - 30 that works though&amp;nbsp; I'm looking to do it from the beginning of previous month whenever I run it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure this is just a stupid thing on my part but I'm slowly losing my sanity.&amp;nbsp; Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 16:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql-to-select-by-date-one-month-back/m-p/166133#M263764</guid>
      <dc:creator>JeffU</dc:creator>
      <dc:date>2014-11-11T16:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: using proc sql to select by date one month back</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql-to-select-by-date-one-month-back/m-p/166134#M263765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's odd, the following program works fine for me.&amp;nbsp; note there is a typo in your code - dot before the entered_date.&amp;nbsp; Are you also sure the entered_date is a date variable?&amp;nbsp; Perhaps post test data where this fails?&lt;/P&gt;&lt;P&gt;data fulltable;&lt;BR /&gt;&amp;nbsp; entered_date="03MAR2014"d;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; entered_date="12NOV2014"d;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table RECENTAPPLICATION as&lt;BR /&gt;&amp;nbsp; select&amp;nbsp; * &lt;BR /&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; FULLTABLE &lt;BR /&gt;&amp;nbsp; where&amp;nbsp;&amp;nbsp; ENTERED_DATE &amp;gt; intnx("month",today(),-1);&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 16:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql-to-select-by-date-one-month-back/m-p/166134#M263765</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-11T16:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: using proc sql to select by date one month back</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql-to-select-by-date-one-month-back/m-p/166135#M263766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And that was it.&amp;nbsp; The entered_date was a datetime.&amp;nbsp; Just needed to put in a datepart() and it took care of it.&amp;nbsp; Thanks so much for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 17:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql-to-select-by-date-one-month-back/m-p/166135#M263766</guid>
      <dc:creator>JeffU</dc:creator>
      <dc:date>2014-11-11T17:52:08Z</dc:date>
    </item>
  </channel>
</rss>

