<?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 first time user: need to delete records outside of date range in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517923#M3462</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brand new to SAS. I need to keep records only between July 1, 2015 and June 30, 2016 for the variable "entry_date." The dates look like 2015-07-01 and 2016-06-30 and the format says&amp;nbsp; YYMMDD10. and the length is 8. Any code suggestions would helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have right now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;set input;&lt;BR /&gt;if entry_date &amp;gt;= '2015-07-01'd and entry_date &amp;lt;= "2016-06-30" then delete;&lt;BR /&gt;run;&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;&lt;P&gt;Mike&lt;/P&gt;</description>
    <pubDate>Sun, 02 Dec 2018 21:28:58 GMT</pubDate>
    <dc:creator>mpoletika1</dc:creator>
    <dc:date>2018-12-02T21:28:58Z</dc:date>
    <item>
      <title>first time user: need to delete records outside of date range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517923#M3462</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brand new to SAS. I need to keep records only between July 1, 2015 and June 30, 2016 for the variable "entry_date." The dates look like 2015-07-01 and 2016-06-30 and the format says&amp;nbsp; YYMMDD10. and the length is 8. Any code suggestions would helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have right now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;set input;&lt;BR /&gt;if entry_date &amp;gt;= '2015-07-01'd and entry_date &amp;lt;= "2016-06-30" then delete;&lt;BR /&gt;run;&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;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 21:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517923#M3462</guid>
      <dc:creator>mpoletika1</dc:creator>
      <dc:date>2018-12-02T21:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: first time user: need to delete records outside of date range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517926#M3463</link>
      <description>&lt;P&gt;You're almost there, but you've got it the wrong way around.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
set input;
if '1jul2015'd &amp;lt;= entry_date &amp;lt;= '30jun2016'd then
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note to keep the date range, you want to output, not delete (note that&amp;nbsp;&lt;EM&gt;delete&lt;/EM&gt; removes observations from the output, not the input!)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
set input;
if '1jul2015'd &amp;lt;= entry_date &amp;lt;= '30jun2016'd;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When you've only got one output dataset, the&amp;nbsp;&lt;EM&gt;output&lt;/EM&gt; action is implied.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 21:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517926#M3463</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2018-12-02T21:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: first time user: need to delete records outside of date range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517928#M3464</link>
      <description>&lt;P&gt;If no further processing or compound expressions involved, filter using "&lt;STRONG&gt;where&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where '01jul2015'd &amp;lt;= entry_date &amp;lt;= '30jun2016'd;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Dec 2018 21:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517928#M3464</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-02T21:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: first time user: need to delete records outside of date range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517929#M3465</link>
      <description>&lt;P&gt;Your biggest issues is that you're specifying the dates incorrectly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS you need to specify a date as a 'date literal' which is using the DATE9 format, wrapping it in quotes and adding a d after wards.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'01Jan2018'd&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This allows SAS to differentiate between a date and a character value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17429"&gt;@LaurieF&lt;/a&gt;&amp;nbsp;mentioned already, your logic was incorrect as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/249035"&gt;@mpoletika1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brand new to SAS. I need to keep records only between July 1, 2015 and June 30, 2016 for the variable "entry_date." The dates look like 2015-07-01 and 2016-06-30 and the format says&amp;nbsp; YYMMDD10. and the length is 8. Any code suggestions would helpful!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I have right now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data new;&lt;BR /&gt;set input;&lt;BR /&gt;if entry_date &amp;gt;= '2015-07-01'd and entry_date &amp;lt;= "2016-06-30" then delete;&lt;BR /&gt;run;&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;
&lt;P&gt;Mike&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 21:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/first-time-user-need-to-delete-records-outside-of-date-range/m-p/517929#M3465</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-02T21:55:16Z</dc:date>
    </item>
  </channel>
</rss>

