<?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: Deleting records with a value not included in a list in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797032#M33026</link>
    <description>&lt;P&gt;Yes. Please specify your problem more carefully and you'll have a usable code answer in no time.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Feb 2022 19:39:42 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2022-02-17T19:39:42Z</dc:date>
    <item>
      <title>Deleting records with a value not included in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/796986#M33025</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to limit my data set to a specific list of county names. Is there a quicker way than repeated IF statements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 18:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/796986#M33025</guid>
      <dc:creator>Ihsan-Mahdi</dc:creator>
      <dc:date>2022-02-17T18:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting records with a value not included in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797032#M33026</link>
      <description>&lt;P&gt;Yes. Please specify your problem more carefully and you'll have a usable code answer in no time.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 19:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797032#M33026</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-17T19:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting records with a value not included in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797055#M33027</link>
      <description>&lt;P&gt;So, I'm working with a data set of about 1M records. A variable in the set specifies the county name. I would like to keep only the records in which the county name belongs to a specific list of 39 counties and delete the rest.&lt;/P&gt;&lt;P&gt;I usually use IF statements, IF county_name="so and so" THEN delete. But since there is a long list of count names I wish to delete I was hoping there would be a shorter way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 20:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797055#M33027</guid>
      <dc:creator>Ihsan-Mahdi</dc:creator>
      <dc:date>2022-02-17T20:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting records with a value not included in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797061#M33028</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you want to compare a single variable to a list of values then the IN operator is your tool of choice:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; countyname in ('Thisname' 'Thatname' 'Another name');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Subsetting the data could be done with either a Where statement or dataset option or an IF statement:&lt;/P&gt;
&lt;PRE&gt;Data want;
    set have;
   where countyname not in ('Thisname' 'Thatname' 'Another name');
run;

or

Data want;
    set have;
   if countyname not in ('Thisname' 'Thatname' 'Another name');
run;&lt;/PRE&gt;
&lt;P&gt;If the list you want to keep is shorter then don't use the NOT in the above examples.&lt;/P&gt;
&lt;P&gt;The IN operator for character values is equivalent to a bunch of equals, so if you have case differences such as your values with "Name"&amp;nbsp; "name" "nAme" etc, for spelling you will need to address that somehow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 20:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797061#M33028</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-17T20:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting records with a value not included in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797068#M33030</link>
      <description>Thank you so much!</description>
      <pubDate>Thu, 17 Feb 2022 20:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-records-with-a-value-not-included-in-a-list/m-p/797068#M33030</guid>
      <dc:creator>Ihsan-Mahdi</dc:creator>
      <dc:date>2022-02-17T20:42:50Z</dc:date>
    </item>
  </channel>
</rss>

