<?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 how to subset with min and max and other combinations of dates in the data? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-subset-with-min-and-max-and-other-combinations-of-dates/m-p/315140#M21261</link>
    <description>&lt;P&gt;I have the following dates data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydates;
  infile cards truncover expandtabs;
  input Date :date9. time :time8.;
  dt = date * 86400 + time;
  format Date date9. time time8. dt datetime19.;
cards;
02Jan2016 18:50:46
04Jan2016 0:08:47
04Jan2016 5:40:23
05Jan2016 11:58:24
12Jan2016 10:06:35
24Jan2016 17:49:23
26Jan2016 9:58:08
29Jan2016 9:58:02
30Jan2016 11:48:34
02Feb2016 13:10:07
04Feb2016 9:12:03
04Feb2016 20:29:06
05Feb2016 11:18:21
06Feb2016 10:24:24
07Feb2016 1:09:35
08Feb2016 10:45:27
09Feb2016 13:10:47
10Feb2016 13:07:53
11Feb2016 13:15:14
12Feb2016 9:35:45
13Feb2016 1:11:07
15Feb2016 9:53:32
16Feb2016 9:51:57&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;29Jun2016 13:15:14
29Jun2016 9:35:45
06Jul2016 1:11:07
06Jul2016 9:53:32
22Sep2016 9:51:57&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt; ; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I am trying to create a subset I used this... but I think this is not correct...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;       PROC SQL;
             SELECT t1.*
                FROM mydates t1
                WHERE t1.Date IN
                     (
                     min(t1.Date),&lt;BR /&gt;                     '29Jun2016'd, '6Jul2016'd,
                     max(t1.Date)
                    );
         QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to write correct code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2016 10:28:26 GMT</pubDate>
    <dc:creator>imanojkumar1</dc:creator>
    <dc:date>2016-11-29T10:28:26Z</dc:date>
    <item>
      <title>how to subset with min and max and other combinations of dates in the data?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-subset-with-min-and-max-and-other-combinations-of-dates/m-p/315140#M21261</link>
      <description>&lt;P&gt;I have the following dates data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydates;
  infile cards truncover expandtabs;
  input Date :date9. time :time8.;
  dt = date * 86400 + time;
  format Date date9. time time8. dt datetime19.;
cards;
02Jan2016 18:50:46
04Jan2016 0:08:47
04Jan2016 5:40:23
05Jan2016 11:58:24
12Jan2016 10:06:35
24Jan2016 17:49:23
26Jan2016 9:58:08
29Jan2016 9:58:02
30Jan2016 11:48:34
02Feb2016 13:10:07
04Feb2016 9:12:03
04Feb2016 20:29:06
05Feb2016 11:18:21
06Feb2016 10:24:24
07Feb2016 1:09:35
08Feb2016 10:45:27
09Feb2016 13:10:47
10Feb2016 13:07:53
11Feb2016 13:15:14
12Feb2016 9:35:45
13Feb2016 1:11:07
15Feb2016 9:53:32
16Feb2016 9:51:57&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;29Jun2016 13:15:14
29Jun2016 9:35:45
06Jul2016 1:11:07
06Jul2016 9:53:32
22Sep2016 9:51:57&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt; ; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I am trying to create a subset I used this... but I think this is not correct...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;       PROC SQL;
             SELECT t1.*
                FROM mydates t1
                WHERE t1.Date IN
                     (
                     min(t1.Date),&lt;BR /&gt;                     '29Jun2016'd, '6Jul2016'd,
                     max(t1.Date)
                    );
         QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to write correct code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 10:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-subset-with-min-and-max-and-other-combinations-of-dates/m-p/315140#M21261</guid>
      <dc:creator>imanojkumar1</dc:creator>
      <dc:date>2016-11-29T10:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to subset with min and max and other combinations of dates in the data?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-subset-with-min-and-max-and-other-combinations-of-dates/m-p/315148#M21263</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  *
  from    MYDATES
  having  DATE=min(DATE) or DATE=max(DATE);
quit;&lt;/PRE&gt;
&lt;P&gt;Pretty sure I mentioned before, but if not, its not a good idea to call columns DATE or TIME, or DATETIME, expecially when you call a variable DATE and its a datatime field. &amp;nbsp;No need to code all in caps either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 10:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-subset-with-min-and-max-and-other-combinations-of-dates/m-p/315148#M21263</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-29T10:57:01Z</dc:date>
    </item>
  </channel>
</rss>

