<?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: Dropping observations with suffix &amp;quot;_A&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dropping-observations-with-suffix-quot-A-quot/m-p/817499#M322685</link>
    <description>&lt;P&gt;You cannot use negative numbers with SUBSTR().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if substrn(category,length(category)-1) = '_A' then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use negative numbers with SCAN().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if scan(category,-1,'_') = 'A' then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you ever have values that are just 'A' without any underscore?&lt;/P&gt;
&lt;P&gt;Do you ever have values with lowercase a as the suffix?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if index(category,'_') and upcase(scan(category,-1,'_')) = 'A' then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2022 16:34:17 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-06-10T16:34:17Z</dc:date>
    <item>
      <title>Dropping observations with suffix "_A"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-observations-with-suffix-quot-A-quot/m-p/817498#M322684</link>
      <description>&lt;P&gt;Hello friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to drop observations ending in "_A" of the variable, "category". I used the following code and didn't work. Could you please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If substr(category, - 1, 2)="_0" then delete;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and all have a wonderful weekend!&lt;/P&gt;&lt;P&gt;Rube&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 16:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-observations-with-suffix-quot-A-quot/m-p/817498#M322684</guid>
      <dc:creator>sandrube</dc:creator>
      <dc:date>2022-06-10T16:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping observations with suffix "_A"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-observations-with-suffix-quot-A-quot/m-p/817499#M322685</link>
      <description>&lt;P&gt;You cannot use negative numbers with SUBSTR().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if substrn(category,length(category)-1) = '_A' then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use negative numbers with SCAN().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if scan(category,-1,'_') = 'A' then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you ever have values that are just 'A' without any underscore?&lt;/P&gt;
&lt;P&gt;Do you ever have values with lowercase a as the suffix?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if index(category,'_') and upcase(scan(category,-1,'_')) = 'A' then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 16:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-observations-with-suffix-quot-A-quot/m-p/817499#M322685</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-10T16:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping observations with suffix "_A"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-observations-with-suffix-quot-A-quot/m-p/817500#M322686</link>
      <description>Thank you very much and have a great weekend!&lt;BR /&gt;&lt;BR /&gt;Rube</description>
      <pubDate>Fri, 10 Jun 2022 16:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-observations-with-suffix-quot-A-quot/m-p/817500#M322686</guid>
      <dc:creator>sandrube</dc:creator>
      <dc:date>2022-06-10T16:35:18Z</dc:date>
    </item>
  </channel>
</rss>

