<?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: Filtering character data only when it has specific characteristics in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145389#M38653</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link active_link" data-avatarid="1002" data-externalid="" data-presence="null" data-userid="255172" data-username="Reeza" href="https://communities.sas.com/people/Reeza" id="jive-25517226183295307458186"&gt;Reeza&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sorry, its not my intention to put you in the spot. I just want to learn. The code you provided is not working. I am returning empty data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp3;&lt;BR /&gt; input string $ 1-11;&lt;BR /&gt; cards;&lt;BR /&gt;abcXxX/&lt;BR /&gt;_jklxxx&lt;BR /&gt;abc.jjj&lt;BR /&gt;xXx()lll&lt;BR /&gt;xxx*aaa&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data temp4;&lt;BR /&gt; set temp3;&lt;/P&gt;&lt;P&gt; if notalpha(string) &amp;gt; 0 then delete ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data = temp4;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I love to learn from Masters like you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Sep 2014 17:55:46 GMT</pubDate>
    <dc:creator>Hima</dc:creator>
    <dc:date>2014-09-15T17:55:46Z</dc:date>
    <item>
      <title>Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145387#M38651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that everyone had a great weekend!&amp;nbsp; I have a quick question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a sas dataset that has a bunch of stock tickers in it, (AAPL, BA, etc) and some of them have a "-" or a "." in them.&amp;nbsp; I want to be able to filter out all of the observations that have these (accidental) special characters in that field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Essentially, I want to keep observations that have only letters in their ticker symbol.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea how this would work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 16:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145387#M38651</guid>
      <dc:creator>mahler_ji</dc:creator>
      <dc:date>2014-09-15T16:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145388#M38652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look at the notalpha function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if notalpha(stock_ticker)&amp;gt;0 then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 16:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145388#M38652</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-09-15T16:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145389#M38653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link active_link" data-avatarid="1002" data-externalid="" data-presence="null" data-userid="255172" data-username="Reeza" href="https://communities.sas.com/people/Reeza" id="jive-25517226183295307458186"&gt;Reeza&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sorry, its not my intention to put you in the spot. I just want to learn. The code you provided is not working. I am returning empty data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp3;&lt;BR /&gt; input string $ 1-11;&lt;BR /&gt; cards;&lt;BR /&gt;abcXxX/&lt;BR /&gt;_jklxxx&lt;BR /&gt;abc.jjj&lt;BR /&gt;xXx()lll&lt;BR /&gt;xxx*aaa&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data temp4;&lt;BR /&gt; set temp3;&lt;/P&gt;&lt;P&gt; if notalpha(string) &amp;gt; 0 then delete ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data = temp4;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I love to learn from Masters like you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 17:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145389#M38653</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2014-09-15T17:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145390#M38654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two reasons:&lt;/P&gt;&lt;P&gt;1. String has trailing blanks that need to be trimmed out.&lt;/P&gt;&lt;P&gt;2. You have no items in your data set that are all alpha to be returned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp3;&lt;/P&gt;&lt;P&gt;input string $ ;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;abcXxX/&lt;/P&gt;&lt;P&gt;_jklxxx&lt;/P&gt;&lt;P&gt;abc.jjj&lt;/P&gt;&lt;P&gt;xXx()lll&lt;/P&gt;&lt;P&gt;xxx*aaa&lt;/P&gt;&lt;P&gt;ABC&lt;/P&gt;&lt;P&gt;APPL&lt;/P&gt;&lt;P&gt;IBM&lt;/P&gt;&lt;P&gt;GOOG&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp4;&lt;/P&gt;&lt;P&gt;set temp3;&lt;/P&gt;&lt;P&gt;if notalpha(trim(string)) &amp;gt; 0 then delete ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = temp4;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 18:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145390#M38654</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-09-15T18:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145391#M38655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Thanks for clarifying. I read the question incorrectly then. You are correct. Thank you so much for your quick reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 18:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145391#M38655</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2014-09-15T18:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145392#M38656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey &lt;A __default_attr="255172" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; and &lt;A __default_attr="5707" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for all of your help, and both answers that were given were amazing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a slightly different question now...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way that I can trim the tickers so that sas will IGNORE everything after a certain character?&amp;nbsp; Like if the symbol is BAB-a, I want the observation to return BAB.&lt;/P&gt;&lt;P&gt;The only thing is, the character length is different. There could be ones with only one or two letters and then a character (i.e. BA-a) and then some are more (GOOG.a).&amp;nbsp; Sometimes the symbol is a dash, sometimes a period and sometimes something else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be amazing!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 01:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145392#M38656</guid>
      <dc:creator>mahler_ji</dc:creator>
      <dc:date>2014-09-16T01:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145393#M38657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look at the scan function...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 01:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145393#M38657</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-09-16T01:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145394#M38658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi john,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thought something like below will help you. The scan function by default recognizes the following delimiters &lt;STRONG&gt; ! $ % &amp;amp; ( ) * + , - . / ;&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By using 1 , sac will output the first string before the delimiters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input dat$;&lt;/P&gt;&lt;P&gt;new=scan(dat,1);&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;BA-a&lt;/P&gt;&lt;P&gt;BAB-a&lt;/P&gt;&lt;P&gt;GOOG.a&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if there are any other delimiters ??, then you can mention the same in scan. However along with these delimiters , you should also include the default delimiters &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input dat$;&lt;/P&gt;&lt;P&gt;new=scan(dat,1,'??&lt;STRONG&gt; ! $ % &amp;amp; ( ) * + , - . / ;&lt;/STRONG&gt;');&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;BA-a&lt;/P&gt;&lt;P&gt;BAB-a&lt;/P&gt;&lt;P&gt;GOOG.a&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 01:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145394#M38658</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-09-16T01:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering character data only when it has specific characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145395#M38659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will get the most flexibility with regular expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;length dat $20;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input dat;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TOOLONGWORD&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ABC1234&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;12abcd&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BA-a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BAB@a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;GOOG.a&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.nothing&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tôt^weird&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* Regular expression: ^: at beginning of string, &lt;STRONG style="font-size: 13.6000003814697px;"&gt;[[:alpha:]]{1,6} : 1 to 6 alpha characters, /..../i : match case insensitive */&lt;/STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not prxId then prxId + prxParse("/^[[:alpha:]]{1,6}/i");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call prxSubstr(prxId, dat, pos, len); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if pos &amp;gt; 0 then word = substr(dat, pos, len);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop pos len prxId;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;title "Words with 1 to 6 alpha characters appearing at the beginning of strings";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data = want noobs;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 03:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-character-data-only-when-it-has-specific/m-p/145395#M38659</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-09-16T03:06:43Z</dc:date>
    </item>
  </channel>
</rss>

