<?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: How to find a particular date from a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358898#M84369</link>
    <description>Thanks for explaining the above cases it is really informative.</description>
    <pubDate>Tue, 16 May 2017 03:05:03 GMT</pubDate>
    <dc:creator>anilatikkha310</dc:creator>
    <dc:date>2017-05-16T03:05:03Z</dc:date>
    <item>
      <title>How to find a particular date from a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358817#M84349</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to fetch the id's who transacted money on 25thDec2016 only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;id&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;Transaction_Amount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;25-Dec-16&lt;/TD&gt;&lt;TD&gt;2300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;16-May-16&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1-Jan-16&lt;/TD&gt;&lt;TD&gt;1200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;25-Dec-16&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;31-Oct-16&lt;/TD&gt;&lt;TD&gt;9000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;25-Sep-16&lt;/TD&gt;&lt;TD&gt;1700&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;25-Dec-16&lt;/TD&gt;&lt;TD&gt;800&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;19-Mar-16&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;9-Jul-16&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;25-Dec-16&lt;/TD&gt;&lt;TD&gt;1500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help!!&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2017 19:04:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358817#M84349</guid>
      <dc:creator>anilatikkha310</dc:creator>
      <dc:date>2017-05-15T19:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a particular date from a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358818#M84350</link>
      <description>&lt;P&gt;How is your data stored? Is date stored as a character or numeric variable?&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2017 19:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358818#M84350</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-05-15T19:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a particular date from a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358820#M84351</link>
      <description>The date is stored in numeric format.&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Mon, 15 May 2017 19:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358820#M84351</guid>
      <dc:creator>anilatikkha310</dc:creator>
      <dc:date>2017-05-15T19:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a particular date from a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358824#M84352</link>
      <description>&lt;P&gt;You can extract the relevant observations like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $ date :date7. Transaction_Amount;
format date date7.;
datalines;
1 25-Dec-16	2300
2 16-May-16	3000
3 1-Jan-16 1200
4 25-Dec-16	4000
5 31-Oct-16	9000
6 25-Sep-16	1700
7 25-Dec-16	800
8 19-Mar-16	500
9 9-Jul-16 2000
10	25-Dec-16 1500
;

data want;  
   set have;
   where date = '25DEC16'd;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is that what you want?&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2017 19:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358824#M84352</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-05-15T19:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a particular date from a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358827#M84354</link>
      <description>&lt;P&gt;If the field is a SAS date, numeric with a date format then you need a &lt;A href="https://statgeeks.wordpress.com/2016/04/24/sas-and-literals/" target="_self"&gt;date literal&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Date Literal (d)&lt;/H3&gt;
&lt;P&gt;When hard coding in a date into your code or creating a date, you need to specify it in the DATE9. format, and add a &lt;STRONG&gt;d&lt;/STRONG&gt; at the end. For example:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;date_var = ’31Jan2016’d;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You aren’t required to put in a 4 year date, but I highly recommend it. Another way to reference a date without using a literal is to use the MDY function. 1,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;x&amp;nbsp;= MDY(1, 31, 2016);&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;With the dates specified in this format you can use it in your code, either assign it to a variable or use it for comparison. The following two lines of code will result in the same thing&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;if x=’31Jan2016’d then do;&lt;/P&gt;
&lt;P&gt;if x=mdy(1, 31, 2016) then do;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 15 May 2017 19:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358827#M84354</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-15T19:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a particular date from a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358898#M84369</link>
      <description>Thanks for explaining the above cases it is really informative.</description>
      <pubDate>Tue, 16 May 2017 03:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-particular-date-from-a-dataset/m-p/358898#M84369</guid>
      <dc:creator>anilatikkha310</dc:creator>
      <dc:date>2017-05-16T03:05:03Z</dc:date>
    </item>
  </channel>
</rss>

