<?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: Check date range from a datasets with 2 dates in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34934#M1459</link>
    <description>The SAS function INTNX can be used to test a SAS variable or constant against a SAS literal (or another SAS variable) as you might need -- using the test you performed for '01OCT2009'd.  Check the SAS DOC on this function - also there will be sample code content and technical/conference papers using the function on the SAS.COM website.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Sat, 26 Dec 2009 14:13:00 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-12-26T14:13:00Z</dc:date>
    <item>
      <title>Check date range from a datasets with 2 dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34931#M1456</link>
      <description>hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a problem on checking date range, consider below dataset layout&lt;BR /&gt;
&lt;BR /&gt;
N  Date1 Date2  Value &lt;BR /&gt;
1  21Jan2009   22Feb2009  5 &lt;BR /&gt;
2 21Jan2009   22Mar2009 6 &lt;BR /&gt;
3 21May2009   22Nov2009  9&lt;BR /&gt;
4 21Oct2009   22Oct2009  34&lt;BR /&gt;
5 21Jan2009   22June2009 6 &lt;BR /&gt;
&lt;BR /&gt;
I want to select entries with the dates fall in October 2009&lt;BR /&gt;
(ie, outcome is record #3,#4 is being selected)&lt;BR /&gt;
&lt;BR /&gt;
any efficient way to compile this??&lt;BR /&gt;
&lt;BR /&gt;
Many thanks</description>
      <pubDate>Fri, 25 Dec 2009 13:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34931#M1456</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-25T13:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Check date range from a datasets with 2 dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34932#M1457</link>
      <description>Hi:&lt;BR /&gt;
  I'm not sure what you mean by selecting entries...do you want a report (such as from PROC PRINT) or a dataset (such as from PROC SQL)??? &lt;BR /&gt;
 &lt;BR /&gt;
  If all you want is a report, you could use a WHERE clause in PROC PRINT. Something like this (assumes that date1 and date2 are numeric variables in the SAS dataset):&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc print data=lib.data;&lt;BR /&gt;
  title 'Use WHERE clause for selection';&lt;BR /&gt;
  where 10 between month(date1) and month(date2) and&lt;BR /&gt;
        (year(date1)=2009 or year(date2)=2009);&lt;BR /&gt;
  format date1 date2 mmddyy10.;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                                                     &lt;BR /&gt;
If the WHERE statement selects the observations you want in the PROC PRINT, then you could use the same WHERE logic in a PROC SQL query to create a dataset. If you know your data are all from 2009, then you don't need the check for year.&lt;BR /&gt;
                    &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 25 Dec 2009 17:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34932#M1457</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-12-25T17:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Check date range from a datasets with 2 dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34933#M1458</link>
      <description>thx cythnia!!&lt;BR /&gt;
&lt;BR /&gt;
actually, proc print or data selection is okay, the dataset may be like this&lt;BR /&gt;
&lt;BR /&gt;
N Date1 Date2 Value&lt;BR /&gt;
1 21Jan2009 22Feb2009 5&lt;BR /&gt;
2 21Jan2009 22Mar2009 6&lt;BR /&gt;
3 21May2009 22Nov2009 9 *&lt;BR /&gt;
4 21Oct2009 22Oct2009 34 *&lt;BR /&gt;
5 21Jan2009 22June2009 6&lt;BR /&gt;
6 3 Mar 2005 22Oct2009 3 *&lt;BR /&gt;
7 3 Mar 2007 31Dec2999 2 *&lt;BR /&gt;
&lt;BR /&gt;
then i want to select records with any dates in October 2009 fall into Date 1 and Date2&lt;BR /&gt;
after i rethink about this scenario, i think&lt;BR /&gt;
&lt;BR /&gt;
if date1 &amp;lt;= '31oct2009'd and date2 &amp;gt;= '1oct2009'd &lt;BR /&gt;
&lt;BR /&gt;
may solve the problem&lt;BR /&gt;
&lt;BR /&gt;
btw, any sas function can cater this scenairo?&lt;BR /&gt;
&lt;BR /&gt;
Thanks again</description>
      <pubDate>Sat, 26 Dec 2009 02:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34933#M1458</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-26T02:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Check date range from a datasets with 2 dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34934#M1459</link>
      <description>The SAS function INTNX can be used to test a SAS variable or constant against a SAS literal (or another SAS variable) as you might need -- using the test you performed for '01OCT2009'd.  Check the SAS DOC on this function - also there will be sample code content and technical/conference papers using the function on the SAS.COM website.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sat, 26 Dec 2009 14:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Check-date-range-from-a-datasets-with-2-dates/m-p/34934#M1459</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-26T14:13:00Z</dc:date>
    </item>
  </channel>
</rss>

