<?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: Delete rows based on date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465655#M118787</link>
    <description>&lt;P&gt;Thank you, that worked perfectly! I had tried something similar to the first option, but with single quotation marks.&lt;/P&gt;</description>
    <pubDate>Tue, 29 May 2018 11:43:13 GMT</pubDate>
    <dc:creator>tv80</dc:creator>
    <dc:date>2018-05-29T11:43:13Z</dc:date>
    <item>
      <title>Delete rows based on date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465643#M118785</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table where I need to delete rows based on two fields, one of which is a date field in YYMMDDN8. format. The idea is to delete rows where the date is not &lt;FONT face="Courier New" size="2"&gt;20170102&lt;/FONT&gt;.&amp;nbsp;I tried a simple PROC SQL command to delete these rows (the date field is marked as 'y' here):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;delete&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.table&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; x=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'12345678'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; and&amp;nbsp;y ne 20170102&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What happens is the command deletes all of the rows where x='12345678' because the date field is not in the right format. How do I need to change the code so that it works?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 10:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465643#M118785</guid>
      <dc:creator>tv80</dc:creator>
      <dc:date>2018-05-29T10:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Delete rows based on date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465646#M118786</link>
      <description>&lt;P&gt;Use a date literal, or input text to a SAS date numeric.&lt;/P&gt;
&lt;PRE&gt;proc sql;
  delete from work.table 
  where x='12345678' and y ne "02JAN2017"d;
quit;
&lt;/PRE&gt;
&lt;P&gt;Note the quotes and the d, this way only accepts ddmmmyyyy format.&lt;/P&gt;
&lt;P&gt;The other:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  delete from work.table 
  where x='12345678' and y ne input('20170102',yymmdd8.);
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 May 2018 10:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465646#M118786</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-29T10:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Delete rows based on date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465655#M118787</link>
      <description>&lt;P&gt;Thank you, that worked perfectly! I had tried something similar to the first option, but with single quotation marks.&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 11:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465655#M118787</guid>
      <dc:creator>tv80</dc:creator>
      <dc:date>2018-05-29T11:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Delete rows based on date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465855#M118830</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/178822"&gt;@tv80&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, that worked perfectly! I had tried something similar to the first option, but with single quotation marks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Single quotes should only have an impact if you are also using macro variables OR if you had spaces between any of the digits and the month name.&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 22:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-rows-based-on-date/m-p/465855#M118830</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-29T22:36:48Z</dc:date>
    </item>
  </channel>
</rss>

