<?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: How do i search for special characters and flag it? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463675#M285006</link>
    <description>&lt;P&gt;The&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;notalpha()&amp;nbsp;&lt;/FONT&gt;&amp;nbsp; function also&amp;nbsp;does what you want.&lt;/P&gt;</description>
    <pubDate>Sun, 20 May 2018 22:52:56 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-05-20T22:52:56Z</dc:date>
    <item>
      <title>How do i search for special characters and flag it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463635#M285003</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that might contain special characters in one of the columns called "DocumentNo".&lt;/P&gt;&lt;P&gt;Based on the characters below, i want to flag it as long as there&amp;nbsp;it exists:&lt;/P&gt;&lt;PRE&gt; 33  21         !
 34  22         "
 35  23         #
 36  24         $
 37  25         %
 38  26         &amp;amp;
 39  27         '
 40  28         (
 41  29         )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the data examples:&lt;/P&gt;&lt;PRE&gt;ID     DocumentNo
1      A1
2      AA
3      B1
4      BB
5      C^*('
6      )(^%$
7      "AA"xx'vvv'&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, ID from 5 onwards contains special characters. I want to create a flag column called 'Flag' to mark as 'Y' for ID 5, 6, 7.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a code/function for this?&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 14:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463635#M285003</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2018-05-20T14:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search for special characters and flag it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463636#M285004</link>
      <description>&lt;P&gt;You could use the findc function. e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID     DocumentNo $20.;
  cards;
1      A1
2      AA
3      B1
4      BB
5      C^*('
6      kk'
7      )(^%$
8      "AA"xx'vvv'
;

data want;
  set have;
  flag=findc(DocumentNo,'!"#$%&amp;amp;''()') gt 0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 14:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463636#M285004</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-05-20T14:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search for special characters and flag it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463639#M285005</link>
      <description>&lt;P&gt;something like this, this will flag anything numeric or character will flag them as Y&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID     DocumentNo $20.;
   if prxmatch("m/[^A-Z0-9]+/oi",trim(DocumentNo)) &amp;gt; 0 then flag = 'Y';
    else flag = "N";
  cards;
1      A1
2      AA
3      B1
4      BB
5      C^*('
6      kk'
7      )(^%$
8      "AA"xx'vvv'
;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 May 2018 15:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463639#M285005</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-05-20T15:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search for special characters and flag it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463675#M285006</link>
      <description>&lt;P&gt;The&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;notalpha()&amp;nbsp;&lt;/FONT&gt;&amp;nbsp; function also&amp;nbsp;does what you want.&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 22:52:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463675#M285006</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-05-20T22:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search for special characters and flag it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463684#M285007</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/63520"&gt;@imdickson&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;In case the list of special characters is not fully defined here a variant to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;'s code which should cover for this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID     DocumentNo $20.;
  cards;
1      A1
2      AA
3      B1
4      BB
5      C^*('
6      kk'
7      )(^%$
8      "AA"xx'vvv'
;
run;

data want;
  set have;
  flag=findc(DocumentNo,' ','kn') gt 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 May 2018 00:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-search-for-special-characters-and-flag-it/m-p/463684#M285007</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-05-21T00:08:06Z</dc:date>
    </item>
  </channel>
</rss>

