<?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 capture special character space in character string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406451#M279334</link>
    <description>&lt;P&gt;Thanks RW09.&lt;/P&gt;
&lt;P&gt;But my query is to find all PID&amp;nbsp;where all special characters including space (i.e space before text, in between text and after text) will be there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My Output would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pid &amp;nbsp; &amp;nbsp;name &amp;nbsp; found&lt;BR /&gt;102 &amp;nbsp; !and &amp;nbsp; &amp;nbsp; &amp;nbsp; !&lt;BR /&gt;104 &amp;nbsp; 1TVN &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;108 &amp;nbsp;K@234 @234&lt;BR /&gt;110 &amp;nbsp;235 &amp;nbsp; &amp;nbsp; &amp;nbsp; 235&lt;BR /&gt;105 &amp;nbsp;A BCD &lt;BR /&gt;106 bd &lt;BR /&gt;109 KRS &lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2017 10:23:55 GMT</pubDate>
    <dc:creator>Abraham</dc:creator>
    <dc:date>2017-10-23T10:23:55Z</dc:date>
    <item>
      <title>How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406444#M279332</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I want to find special characters for the variable name but &amp;nbsp;i am missing few records where the variable name contain space followed by alphabetical or space in between alphabets &amp;nbsp;or alphabets followed by space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to capture records using regular expression where spaces are available like pid 105, 106 and 109.&lt;/P&gt;
&lt;P&gt;I use the below approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data find;
input pid name $;
cards;
101 acbd
102 !and
103 X.Y
104 1TVN
105 A BCD
106 bd  
107 ANKR
108 K@234
109  KRS
110 235
;
run;

data find1;
set find;
found= prxchange('s/[A-Za-z.]//i',-1,name);
run;

data find2;
set find1;
where found ne '';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 09:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406444#M279332</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2017-10-23T09:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406445#M279333</link>
      <description>&lt;P&gt;Use compress:&lt;/P&gt;
&lt;PRE&gt;data find2;
  set find;
  where lengthn(compress(name,," ","ad"))&amp;gt;0;
run;&lt;/PRE&gt;
&lt;P&gt;This will remove all alphanumeric characters from the string, then if the length left is greater than zero you have special characters.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 09:57:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406445#M279333</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-23T09:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406451#M279334</link>
      <description>&lt;P&gt;Thanks RW09.&lt;/P&gt;
&lt;P&gt;But my query is to find all PID&amp;nbsp;where all special characters including space (i.e space before text, in between text and after text) will be there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My Output would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pid &amp;nbsp; &amp;nbsp;name &amp;nbsp; found&lt;BR /&gt;102 &amp;nbsp; !and &amp;nbsp; &amp;nbsp; &amp;nbsp; !&lt;BR /&gt;104 &amp;nbsp; 1TVN &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;108 &amp;nbsp;K@234 @234&lt;BR /&gt;110 &amp;nbsp;235 &amp;nbsp; &amp;nbsp; &amp;nbsp; 235&lt;BR /&gt;105 &amp;nbsp;A BCD &lt;BR /&gt;106 bd &lt;BR /&gt;109 KRS &lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 10:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406451#M279334</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2017-10-23T10:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406455#M279335</link>
      <description>&lt;P&gt;You just need to fiddle with it a bit:&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt; infile datalines dlm=",";&lt;BR /&gt; input pid name $;&lt;BR /&gt;datalines;&lt;BR /&gt;102,!and&lt;BR /&gt;104,1TVN&lt;BR /&gt;108,K@234&lt;BR /&gt;105,A BCD &lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; find=compress(name,"","a");&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;This works for all but the space part.&amp;nbsp; Now this is more of an issue, because depending on the length of name&amp;nbsp;&lt;STRONG&gt;all&lt;/STRONG&gt; of the given items contain blanks after the text up to the length of the text string.&amp;nbsp; So say name is $8:&lt;/P&gt;
&lt;P&gt;!and&lt;/P&gt;
&lt;P&gt;has four "spaces" after the text there.&amp;nbsp; So checking space afterwards doesn't make much sense.&amp;nbsp; If its before or during then possibly.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 10:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406455#M279335</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-23T10:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406457#M279336</link>
      <description>&lt;P&gt;In your original dataset, the "leading" and "included" spaces never end up in the variables, as they are considered to be delimiters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data find;
input pid name $;
cards;
101 acbd
102 !and
103 X.Y
104 1TVN
105 A BCD
106 bd  
107 ANKR
108 K@234
109  KRS
110 235
;
run;

data check;
set find;
check = put(name,$hex16.);
run;

proc print data=check noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;pid    name          check

101    acbd     6163626420202020
102    !and     21616E6420202020
103    X.Y      582E592020202020
104    1TVN     3154564E20202020
105    A        4120202020202020
106    bd       6264202020202020
107    ANKR     414E4B5220202020
108    K@234    4B40323334202020
109    KRS      4B52532020202020
110    235      3233352020202020
&lt;/PRE&gt;
&lt;P&gt;To read leading and inserted spaces successfully, use the dsd and dlm= options, and the $CHAR informat:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data find;
infile cards dlm=' ' dsd;
input pid name :$char8.;
cards;
101 "acbd"
102 "!and"
103 "X.Y"
104 "1TVN"
105 "A BCD"
106 "bd  "
107 "ANKR"
108 "K@234"
109 " KRS"
110 "235"
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 10:55:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406457#M279336</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-23T10:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406473#M279337</link>
      <description>&lt;P&gt;Thank you very much for your support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any possibility to capture the same record using&amp;nbsp;prxchange function. I would like to learn it. I browse in google and found /s to be used. But it is not working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestion will be highly appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 12:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406473#M279337</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2017-10-23T12:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406611#M279338</link>
      <description>&lt;P&gt;Thanks once again for your guidance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to learn is there any option in regular expression where I can add to &lt;STRONG&gt;prxchange&lt;/STRONG&gt; function to capture the PID containing space&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like 105 and 109 or any alternative regexpression.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;prxchange&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'s/[A-Za-z.]//i'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;name&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 16:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406611#M279338</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2017-10-23T16:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture special character space in character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406910#M279339</link>
      <description>Can anybody help me is it possible to capture special characters using regular expression including space.&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Tue, 24 Oct 2017 11:30:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-special-character-space-in-character-string/m-p/406910#M279339</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2017-10-24T11:30:20Z</dc:date>
    </item>
  </channel>
</rss>

