<?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 to identify the records in the column other than alpha numeric and hypen in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923696#M363646</link>
    <description>You need to strip the blanks at end of string.&lt;BR /&gt; if prxmatch('/[^[:alnum:]-]/', column) &amp;gt; 0 then&lt;BR /&gt;----&amp;gt;&lt;BR /&gt;    if prxmatch('/[^[:alnum:]-]/', strip(column)) &amp;gt; 0 then&lt;BR /&gt;</description>
    <pubDate>Wed, 10 Apr 2024 02:41:56 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2024-04-10T02:41:56Z</dc:date>
    <item>
      <title>How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923608#M363608</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    input column $20.;
    datalines;
abc-def1
(123-456
xyz789
!@#$%^&amp;amp;*
;
run;
data check_special_chars;
    set have;

    /* Use PRXMATCH to search for characters that are not alphanumeric or hyphen */
    if prxmatch('/[^[:alnum:]-]/', column) &amp;gt; 0 then
        special_chars_found = 1;
    else
        special_chars_found = 0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;am expecting :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;column&amp;nbsp; &amp;nbsp;special_chars_found&lt;/P&gt;
&lt;P&gt;abc-def1&amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;(123-456&amp;nbsp; &amp;nbsp;1&lt;BR /&gt;xyz789&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;!@#$%^&amp;amp;* 1&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 13:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923608#M363608</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-04-09T13:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923609#M363609</link>
      <description>The above prxmatch is not working as expected</description>
      <pubDate>Tue, 09 Apr 2024 13:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923609#M363609</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-04-09T13:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923614#M363610</link>
      <description>&lt;P&gt;keep it simple:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    input column $20.;
    datalines;
abc-def1
(123-456
xyz789
!@#$%^&amp;amp;*
;
run;
data want;
set have;
check = 1 &amp;amp; lengthn(compress(column,"-","AD"));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 13:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923614#M363610</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-04-09T13:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923615#M363611</link>
      <description>&lt;P&gt;I would let the FINDC function do the work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    z=findc(column,'-','adkt')&amp;gt;0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2024 13:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923615#M363611</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-09T13:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923620#M363612</link>
      <description>Perfect , thanks so much &lt;BR /&gt;Both solutions working as perfect &lt;BR /&gt;can you share what does keyword 'adkt' mean ?  in below function&lt;BR /&gt;findc(column,'-','adkt')</description>
      <pubDate>Tue, 09 Apr 2024 13:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923620#M363612</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-04-09T13:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923622#M363613</link>
      <description>Thanks for your tip , what does this   AD  mean here  ?  lengthn(compress(column,"-","AD"));</description>
      <pubDate>Tue, 09 Apr 2024 14:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923622#M363613</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-04-09T14:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923625#M363614</link>
      <description>&lt;P&gt;From the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/n1mdh2gvd5potjn14jipysvzn4o7.htm" target="_self"&gt;FINDC documentation&lt;/A&gt;, there are many "modifiers" that alter the search based upon many different criteria.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Letter a "&lt;SPAN&gt;adds alphabetic characters to the list of characters" that are in the search.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can look up the other modifiers at that link.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 14:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923625#M363614</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-09T14:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923629#M363615</link>
      <description>Thanks so much for the details</description>
      <pubDate>Tue, 09 Apr 2024 14:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923629#M363615</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-04-09T14:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923630#M363616</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/225493"&gt;@learn_SAS_23&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Perfect , thanks so much &lt;BR /&gt;Both solutions working as perfect &lt;BR /&gt;can you share what does keyword 'adkt' mean ? in below function&lt;BR /&gt;findc(column,'-','adkt')&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not a keyword, that is a list of modifiers to the function. 'a' or 'A' adds all alphabetic characters to the list to search for, 'd' or 'D' adds all digits to the list. So Findc(column,'-','ad') searches for the dash and all letters or digits. The 'k' says 'find characters not in the&amp;nbsp; list. Findc(column,'-','adk') finds all characters not in the list dash, letter or digit. The 't' removes any trailing spaces from the string and the character list. Many of the search functions in SAS will include trailing spaces if the length of a given variable is longer than is "used".&amp;nbsp; The reason T is added to the modifiers is demonstrated with this:&lt;/P&gt;
&lt;PRE&gt;data example;
   length str1  $ 6;
   str1='a1-';
   result1 =findc(str1,'-','adk');
   result2 =findc(str1,'-','adkt');
run;&lt;/PRE&gt;
&lt;P&gt;Result 1 is 4 because the full length of the variable str1 has been "padded" to the length of 6 characters with trailing spaces and is found by the function at position 4 to have something other than dash, letter or digit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 14:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923630#M363616</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-09T14:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923631#M363617</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;compress(&lt;/STRONG&gt;column,&lt;STRONG&gt;"-","AD"&lt;/STRONG&gt;) means: delete hyphen, Alphabet letters, and Digits &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;[EDIT:] If there is a space in your text, e.g., "AB CD" and you don't want it too this code won't be enough. But &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;'s code with FINDC() will work.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Bart&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 14:32:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923631#M363617</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-04-09T14:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923696#M363646</link>
      <description>You need to strip the blanks at end of string.&lt;BR /&gt; if prxmatch('/[^[:alnum:]-]/', column) &amp;gt; 0 then&lt;BR /&gt;----&amp;gt;&lt;BR /&gt;    if prxmatch('/[^[:alnum:]-]/', strip(column)) &amp;gt; 0 then&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Apr 2024 02:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923696#M363646</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-10T02:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923737#M363652</link>
      <description>Thanks , &lt;BR /&gt;&lt;BR /&gt;data check_special_chars;&lt;BR /&gt;    set have;&lt;BR /&gt;&lt;BR /&gt;    /* Use PRXMATCH to search for characters that are not alphanumeric or hyphen */&lt;BR /&gt;    if prxmatch('/[^[:alnum:]-]/', strip(column)) &amp;gt; 0 then&lt;BR /&gt;        special_chars_found = 1;&lt;BR /&gt;    else&lt;BR /&gt;        special_chars_found = 0;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Now this method also works</description>
      <pubDate>Wed, 10 Apr 2024 06:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923737#M363652</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-04-10T06:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the records in the column other than alpha numeric and hypen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923738#M363653</link>
      <description>Thanks for clear details !!, it helps</description>
      <pubDate>Wed, 10 Apr 2024 06:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-records-in-the-column-other-than-alpha/m-p/923738#M363653</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-04-10T06:57:21Z</dc:date>
    </item>
  </channel>
</rss>

