<?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: I want to find a date after today's date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904090#M40372</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;That is my real data. Let me explain with an example. If you see the first row the new_date is after today's date which is 21/11/23. The first row shows new_date as 26/11/23. Rest of all the dates in new_date is before today's date. I want only those records which are after today's date (21/11/23). So from the sample data, it should show only the first record. But when I run my code, it includes all the dates from previous table (before today's date and after today's date).&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 13:15:29 GMT</pubDate>
    <dc:creator>Sandeep77</dc:creator>
    <dc:date>2023-11-21T13:15:29Z</dc:date>
    <item>
      <title>I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904077#M40367</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am trying to find only those records which have new_date after today's date. I have tried a code but it shows all the records from the previous table and not the records which has new_date after today's date. Please suggest. I want the output data to show only those records which have new_date after today. Here is the sample data:&lt;/P&gt;
&lt;P&gt;Data Delayed Accounts; &lt;BR /&gt;infile cards expandtabs; &lt;BR /&gt;input debt_code rep_code$ dt_delaydays dt_datdelay:date9. new_date :date9.;&lt;BR /&gt;format dt_datdelay date9. new_date :date9.; &lt;BR /&gt;datalines ; &lt;BR /&gt;422555961 122 6 20NOV2023:00:00:00.000 26NOV2023:00:00:00.000&lt;BR /&gt;339877599 168 5 24JUL2020:00:00:00.000 29JUL2020:00:00:00.000&lt;BR /&gt;344681317 168C 5 12FEB2020:00:00:00.000 17FEB2020:00:00:00.000&lt;BR /&gt;332355999 168 4 23FEB2021:00:00:00.000 27FEB2021:00:00:00.000&lt;BR /&gt;308007913 133 30 05AUG2019:00:00:00.000 04SEP2019:00:00:00.000&lt;BR /&gt;run;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
create table delayed_accounts_new as 
select * 
from delayed_accounts 
where new_date &amp;gt; today(); 
quit;
Log:
30         proc sql;
31         create table delayed_accounts_new as
32         select *
33         from delayed_accounts
34         where new_date &amp;gt; today();
NOTE: Compressing data set WORK.DELAYED_ACCOUNTS_NEW decreased size by 19.63 percent. 
      Compressed is 176 pages; un-compressed would require 219 pages.
NOTE: Table WORK.DELAYED_ACCOUNTS_NEW created, with 254954 rows and 5 columns.

35         quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 12:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904077#M40367</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-11-21T12:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904083#M40368</link>
      <description>&lt;P&gt;Your code looks like it should work properly. It works for me on your sample data.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904083#M40368</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-21T13:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904084#M40369</link>
      <description>&lt;P&gt;It works fine but it shows all the record from the&amp;nbsp;delayed_accounts table. I want only those records which have new_date after today's date.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904084#M40369</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-11-21T13:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904085#M40370</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391779"&gt;@Sandeep77&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It works fine but it shows all the record from the&amp;nbsp;delayed_accounts table. I want only those records which have new_date after today's date.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your code works properly on the sample data you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps the sample data does not really represent your actual data?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904085#M40370</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-21T13:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904088#M40371</link>
      <description>&lt;P&gt;If, in your real data, new_date is not a date but a datetime, your code can't work as intended.&lt;/P&gt;
&lt;P&gt;Maxim 3:&amp;nbsp;&lt;STRONG&gt;Know Your Data.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Also remember the stuff I told you to write down 100 times?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904088#M40371</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-11-21T13:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904090#M40372</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;That is my real data. Let me explain with an example. If you see the first row the new_date is after today's date which is 21/11/23. The first row shows new_date as 26/11/23. Rest of all the dates in new_date is before today's date. I want only those records which are after today's date (21/11/23). So from the sample data, it should show only the first record. But when I run my code, it includes all the dates from previous table (before today's date and after today's date).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904090#M40372</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-11-21T13:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904091#M40373</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391779"&gt;@Sandeep77&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;That is my real data.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am extremely skeptical. It is much more likely that you have date/time values instead of date values. If you really have date values, your code will work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904091#M40373</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-21T13:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904098#M40374</link>
      <description>&lt;P&gt;Run PROC CONTENTS on your real data and post the result. There's no sense in trying to help you further unless you do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this should reflect your real data, then your DATA step has to look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data delayed_accounts; 
infile cards; 
input debt_code rep_code $ dt_delaydays dt_datdelay :date9. new_date :date9.;
format dt_datdelay new_date date9.; 
datalines; 
422555961 122 6 20NOV2023 26NOV2023
339877599 168 5 24JUL2020 29JUL2020
344681317 168C 5 12FEB2020 17FEB2020
332355999 168 4 23FEB2021 27FEB2021
308007913 133 30 05AUG2019 04SEP2019
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;just for clarity.&lt;/P&gt;
&lt;P&gt;Then your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
create table delayed_accounts_new as 
select * 
from delayed_accounts 
where new_date &amp;gt; today(); 
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will work, as the log clearly indicates:&lt;/P&gt;
&lt;PRE&gt; 69         proc sql;
 70         create table delayed_accounts_new as
 71         select *
 72         from delayed_accounts
 73         where new_date &amp;gt; today();
 NOTE: Table WORK.DELAYED_ACCOUNTS_NEW created, with 1 rows and 5 columns.
&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904098#M40374</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-11-21T13:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904109#M40376</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;, My data is a datetime value (datetime22.3). For eg&amp;nbsp;12APR2023:00:00:00.000. Is that what you are asking?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 14:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904109#M40376</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-11-21T14:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904110#M40377</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391779"&gt;@Sandeep77&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;, My data is a datetime value (datetime22.3). For eg&amp;nbsp;12APR2023:00:00:00.000. Is that what you are asking?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So then your sample data does not represent your actual data. In your sample data, new_date is a date value. Now you are saying it is a datetime value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you need is:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where datepart(new_date) &amp;gt; today(); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2023 15:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904110#M40377</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-21T15:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a date after today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904113#M40378</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;. Thanks, it worked. I am not very good with the dates in SAS. Thanks</description>
      <pubDate>Tue, 21 Nov 2023 15:03:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-find-a-date-after-today-s-date/m-p/904113#M40378</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-11-21T15:03:15Z</dc:date>
    </item>
  </channel>
</rss>

