<?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: WHERE statement for dates? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103356#M291269</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you can see, SAS is very resourceful when dealing with date variable, the following two options should work for you as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where month(date)=1 and year(date)=2000;&lt;/P&gt;&lt;P&gt;where put(date,monyy7.)='JAN2000';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Dec 2012 05:07:21 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2012-12-19T05:07:21Z</dc:date>
    <item>
      <title>WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103347#M291260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking for information on how to use a WHERE statement in a PROC PRINT to specify a date. For example I want to show all observations where data equal to 1 Jan 2000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 20:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103347#M291260</guid>
      <dc:creator>pmdci</dc:creator>
      <dc:date>2012-12-18T20:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103348#M291261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;proc print data = your_data;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where date = mdy(01,01,2000);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;var var_list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck,&lt;/P&gt;&lt;P&gt;Anca.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 20:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103348#M291261</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2012-12-18T20:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103349#M291262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;where date = '01jan2000'd;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice the d at the end and the quotations around the date. The quotations can be single or double and the year can be two or four digit. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 21:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103349#M291262</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-18T21:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103350#M291263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anca,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for that. Is it possible to use the same function to return all observations from January 2000, regardless of the day?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 21:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103350#M291263</guid>
      <dc:creator>pmdci</dc:creator>
      <dc:date>2012-12-18T21:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103351#M291264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the d at the end for? Also how would SAS know the date format (e.g.: dd/mm/yy, mm/dd/yy, dd/mm/yyyy, etc) and would it be possible to specify only the month and the year?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 21:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103351#M291264</guid>
      <dc:creator>pmdci</dc:creator>
      <dc:date>2012-12-18T21:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103352#M291265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #000080; font-size: 10pt; font-family: Courier New;"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; date between mdy(&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2000&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;) and mdy(&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;31&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2000&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 21:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103352#M291265</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-12-18T21:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103353#M291266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or:&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input date mmddyy10.;&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;01/31/2000&lt;/P&gt;&lt;P&gt;01/02/2000&lt;/P&gt;&lt;P&gt;02/04/2000&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc print data=have;&lt;/P&gt;&lt;P&gt; where date between intnx('month','01jan2000'd,0,'b') and intnx('month','01jan2000'd,0,'e') ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 21:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103353#M291266</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-12-18T21:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103354#M291267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS stores dates as numbers, the format is only used to display the numbers so when you specify the 'd' it tells SAS it's a date and it converts it into a number. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also specify a between with the literals:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where date between '01jan2000'd and '31jan2000'd but then you have to know the start and end of the month.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LinLin's solution above is better for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also specify the month and year separately&lt;/P&gt;&lt;P&gt;where month(date)=1 and year(date)=2000;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 21:25:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103354#M291267</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-18T21:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103355#M291268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@pmdci&lt;/P&gt;&lt;P&gt;The SAS date literal requires the date to be in a DATE informat.&amp;nbsp; Other date informats are not supported. The following will work (not an exhaustive list):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '01jan80'd &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '01jan1980'd&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '01-jan-1980'd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use the INTCK function : &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #000080;"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #0000ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;=have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt; intck('month', '&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #008080;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;jan&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #008080;"&gt;2000'd, date&lt;/STRONG&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;) = 0 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;Richard&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 23:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103355#M291268</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-12-18T23:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE statement for dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103356#M291269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you can see, SAS is very resourceful when dealing with date variable, the following two options should work for you as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where month(date)=1 and year(date)=2000;&lt;/P&gt;&lt;P&gt;where put(date,monyy7.)='JAN2000';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2012 05:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHERE-statement-for-dates/m-p/103356#M291269</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-12-19T05:07:21Z</dc:date>
    </item>
  </channel>
</rss>

