<?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: SAS code trying to delete all rows not matching an entry in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377578#M90681</link>
    <description>&lt;P&gt;Depends upon what values you have for Month, Day and Year. You may be able to use something like:&lt;/P&gt;
&lt;PRE&gt;DATA Alaska (drop=Month Day Year);
  SET Work.earthquake;
  format EruptionDate date9.;
  IF State = 'Alaska' THEN do;
    EruptionDate = mdy(Month, Day, Year);
    output;
  end;
RUN;
PROC PRINT Data= Alaska;
 WHERE year(EruptionDate) GT 2005;
RUN;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2017 20:30:40 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-07-19T20:30:40Z</dc:date>
    <item>
      <title>SAS code trying to delete all rows not matching an entry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377518#M90656</link>
      <description>&lt;P&gt;I am working in SAS 9.4. &amp;nbsp;I have a data set and one of the variables is called 'state'. &amp;nbsp;I need to remove all rows in which the 'state' variable is not equal to 'Alaska'. &amp;nbsp;I also need to combine three other variables (month, day, and year) to create a new variable called EruptionDate and then drop those other 3 variables. &amp;nbsp;The final thing that I can't figure out is how to only display the eruptions occuring after the year 2005. &amp;nbsp;I am quite new to SAS and programming in general and this is what I have so far, but it's not working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA Alsaka;&lt;/P&gt;&lt;P&gt;&amp;nbsp;SET Work.earthquake;&lt;/P&gt;&lt;P&gt;IF State = Alaska&lt;/P&gt;&lt;P&gt;&amp;nbsp;THEN EruptionDate = Month, Day, Year&lt;/P&gt;&lt;P&gt;&amp;nbsp;ELSE REMOVE row;&lt;/P&gt;&lt;P&gt;DROP Month;&lt;/P&gt;&lt;P&gt;DROP Day;&lt;/P&gt;&lt;P&gt;DROP Year;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC PRINT Data= Alaska;&lt;/P&gt;&lt;P&gt;&amp;nbsp;WHERE year GT 2005;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377518#M90656</guid>
      <dc:creator>Moviefan04</dc:creator>
      <dc:date>2017-07-19T18:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code trying to delete all rows not matching an entry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377566#M90680</link>
      <description>&lt;P&gt;There are errors in your code. Can you post a few observations of your data?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 20:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377566#M90680</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2017-07-19T20:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code trying to delete all rows not matching an entry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377578#M90681</link>
      <description>&lt;P&gt;Depends upon what values you have for Month, Day and Year. You may be able to use something like:&lt;/P&gt;
&lt;PRE&gt;DATA Alaska (drop=Month Day Year);
  SET Work.earthquake;
  format EruptionDate date9.;
  IF State = 'Alaska' THEN do;
    EruptionDate = mdy(Month, Day, Year);
    output;
  end;
RUN;
PROC PRINT Data= Alaska;
 WHERE year(EruptionDate) GT 2005;
RUN;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 20:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377578#M90681</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-19T20:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code trying to delete all rows not matching an entry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377911#M90781</link>
      <description>&lt;P&gt;I made a few adjustments to tailor it to get my desired result but your post helped a lot. &amp;nbsp;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 20:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-trying-to-delete-all-rows-not-matching-an-entry/m-p/377911#M90781</guid>
      <dc:creator>Moviefan04</dc:creator>
      <dc:date>2017-07-20T20:09:20Z</dc:date>
    </item>
  </channel>
</rss>

