<?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: Finding Special Characters using Proc SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334511#M272247</link>
    <description>&lt;P&gt;You have an extra parenthesis in your first use of the index function. The following worked for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data Have;
  length Frst_Nm $30.;
  i=1;
  Frst_Nm=catt('John','09'x,'Junk');
  output;
  i=2;
  Frst_Nm=catt('John','0A'x,'Junk');
  output;
  i=3;
  Frst_Nm=catt('John','0B'x,'Junk');
  output;
  i=4;
  Frst_Nm=catt('John','0D'x,'Junk');
  output;
  i=5;
  Frst_Nm=catt('John','Junk');
  output;
run;

proc sql;
  select *,
  (index(Frst_Nm,'09'x) &amp;gt;0 /*Horizontal Tab*/
    Or index(Frst_Nm, '0A'x) &amp;gt; 0 /* Line Feed*/
    Or index(Frst_Nm, '0B'x) &amp;gt; 0 /*Vertical tab*/
    Or index(Frst_Nm, '0D'x) &amp;gt; 0 /*Carrriage Return*/
  ) as test
    from have
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2017 00:28:25 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-02-21T00:28:25Z</dc:date>
    <item>
      <title>Finding Special Characters using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334509#M272246</link>
      <description>&lt;P&gt;I want to use Proc SQL to find out if there are any data in the column with Vertical Tab, Line Feed, Horizontal Tab, Carraige Return.&lt;/P&gt;&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;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Last_Nm&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'0D'XC&lt;/SPAN&gt;&lt;SPAN&gt; ) &lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN&gt;0&lt;/SPAN&gt; &lt;SPAN&gt;-- Carrriage Return&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I used the below conditions in SAS EG inside a Proc SQL and it does not work.&lt;/P&gt;&lt;P&gt;(index(Frst_Nm,'09'x) &amp;gt;0) /*Horizontal Tab*/&lt;BR /&gt;Or index(Frst_Nm, '0A'x) &amp;gt; 0 /* Line Feed*/&lt;BR /&gt;Or index(Frst_Nm, '0B'x) &amp;gt; 0 /*Vertical tab*/&lt;BR /&gt;Or index(Frst_Nm, '0D'x) &amp;gt; 0 /*Carrriage Return*/&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there any other ways?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 23:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334509#M272246</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2017-02-20T23:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Special Characters using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334511#M272247</link>
      <description>&lt;P&gt;You have an extra parenthesis in your first use of the index function. The following worked for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data Have;
  length Frst_Nm $30.;
  i=1;
  Frst_Nm=catt('John','09'x,'Junk');
  output;
  i=2;
  Frst_Nm=catt('John','0A'x,'Junk');
  output;
  i=3;
  Frst_Nm=catt('John','0B'x,'Junk');
  output;
  i=4;
  Frst_Nm=catt('John','0D'x,'Junk');
  output;
  i=5;
  Frst_Nm=catt('John','Junk');
  output;
run;

proc sql;
  select *,
  (index(Frst_Nm,'09'x) &amp;gt;0 /*Horizontal Tab*/
    Or index(Frst_Nm, '0A'x) &amp;gt; 0 /* Line Feed*/
    Or index(Frst_Nm, '0B'x) &amp;gt; 0 /*Vertical tab*/
    Or index(Frst_Nm, '0D'x) &amp;gt; 0 /*Carrriage Return*/
  ) as test
    from have
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 00:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334511#M272247</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-21T00:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Special Characters using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334541#M272248</link>
      <description>&lt;PRE&gt;
It is easy for Perl Regular Expression.


data Have;
  length Frst_Nm $30.;
  i=1;
  Frst_Nm=catt('John','09'x,'Junk');
  output;
  i=2;
  Frst_Nm=catt('John','0A'x,'Junk');
  output;
  i=3;
  Frst_Nm=catt('John','0B'x,'Junk');
  output;
  i=4;
  Frst_Nm=catt('John','0D'x,'Junk');
  output;
  i=5;
  Frst_Nm=catx(' ','John','Junk');
  output;
run;
proc sql;
select *,case when prxmatch('/\s/',compress(frst_nm,' ')) then 1 else 0 end as flag
 from have;
quit;

&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2017 02:49:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334541#M272248</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-21T02:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Special Characters using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334556#M272249</link>
      <description>&lt;P&gt;Function anycntrl detects &lt;EM&gt;control&lt;/EM&gt; characters:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select *, anycntrl(Frst_nm) &amp;gt; 0 as flag
 from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2017 04:25:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334556#M272249</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-21T04:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Special Characters using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334561#M272250</link>
      <description>&lt;P&gt;Thanks. I will try this option.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 04:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334561#M272250</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2017-02-21T04:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Special Characters using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334562#M272251</link>
      <description>&lt;P&gt;I may have put an extra bracket when typing up the post. I am using this code in the SAS CI as an exclusion list. but it seems to be working sometimes but not when the campaign is scheduled.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 04:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Special-Characters-using-Proc-SQL/m-p/334562#M272251</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2017-02-21T04:54:22Z</dc:date>
    </item>
  </channel>
</rss>

