<?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: Replacing '_' with ' '(Spaces) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141591#M37787</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 suggestions.&amp;nbsp; Firstly post exactly what you are doing code/file so we can see.&amp;nbsp; Secondly, open the file using a hex editor and check what those characters are in reality, sometimes special characters do odd things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if you cant get trawrd to work, you cold always parse the string as loop:&lt;/P&gt;&lt;P&gt;do I=1 to length(strip(variable));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(variable,i,1) in ("_") then substr(variable,i,1)=" ";&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jan 2015 09:11:44 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-01-28T09:11:44Z</dc:date>
    <item>
      <title>Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141586#M37782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a String, say str = 'a_b_cd___efg_h__ijkl___m'. I need this string to be translated to 'a b cd&amp;nbsp;&amp;nbsp;&amp;nbsp; efg h&amp;nbsp;&amp;nbsp; ijkl&amp;nbsp;&amp;nbsp;&amp;nbsp; m'. I have tried TRANSLATE(str,' ','_'). But all I see is 'a b cd efg h ijkl m'. The number of spaces placed between the characters is not the same as the number of underscores present, if there are multiple undersocres adjacant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sai Chaitanya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 05:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141586#M37782</guid>
      <dc:creator>ChaitanyaEmani</dc:creator>
      <dc:date>2015-01-28T05:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141587#M37783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; for me it works well. For example in this context&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data my;&lt;/P&gt;&lt;P&gt;str = 'a_b_cd___efg_h__ijkl___m';&lt;/P&gt;&lt;P&gt;a=TRANSLATE(str,' ','_');&lt;/P&gt;&lt;P&gt;b=TRANWRD(str,'_',' ');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a=a b cd&amp;nbsp;&amp;nbsp; efg h&amp;nbsp; ijkl&amp;nbsp;&amp;nbsp; m;&lt;/P&gt;&lt;P&gt;b=a b cd&amp;nbsp;&amp;nbsp; efg h&amp;nbsp; ijkl&amp;nbsp;&amp;nbsp; m;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe the problem is elsewhere?&lt;/P&gt;&lt;P&gt;Jakub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 07:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141587#M37783</guid>
      <dc:creator>chrej5am</dc:creator>
      <dc:date>2015-01-28T07:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141588#M37784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What version of SAS are you using? SAS studio or SAS UE? The HTML editor may be 'eating' the spaces. &lt;/P&gt;&lt;P&gt;Using a put statement shows the actual variable. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 07:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141588#M37784</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-28T07:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141589#M37785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;str = 'a_b_cd___efg_h__ijkl___m';&lt;BR /&gt;want=prxchange('s/_/ /i',-1,str);&lt;BR /&gt;put want=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 08:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141589#M37785</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2015-01-28T08:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141590#M37786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;I am using SAS 9.2 on mainframe. There is no HTML used and all the output is sent to a flat file on mainframe. There are many such strings in the input file with '_' characters and all of them have to be replaced with spaces. Unable to decode on why the TRANSLATE/TRANWRD is not working for me unlike Jakub.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sai Chaitanya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 09:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141590#M37786</guid>
      <dc:creator>ChaitanyaEmani</dc:creator>
      <dc:date>2015-01-28T09:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141591#M37787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 suggestions.&amp;nbsp; Firstly post exactly what you are doing code/file so we can see.&amp;nbsp; Secondly, open the file using a hex editor and check what those characters are in reality, sometimes special characters do odd things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if you cant get trawrd to work, you cold always parse the string as loop:&lt;/P&gt;&lt;P&gt;do I=1 to length(strip(variable));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(variable,i,1) in ("_") then substr(variable,i,1)=" ";&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 09:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141591#M37787</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-28T09:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141592#M37788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Loko,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regular expression worked for me. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sai Chaitanya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 09:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141592#M37788</guid>
      <dc:creator>ChaitanyaEmani</dc:creator>
      <dc:date>2015-01-28T09:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141593#M37789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please explain what does 'i' and '-1' stand for in the regexp ?&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;prxchange('s/_/ /i',-1,str);&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 08:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141593#M37789</guid>
      <dc:creator>Lastwish</dc:creator>
      <dc:date>2015-01-29T08:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing '_' with ' '(Spaces)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141594#M37790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;prxchange('s/_/ /i',-1,str);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value i indicates to ignore the case of the character in the expression. For this particular example i can be ignored.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-size: 13.4399995803833px; line-height: 1.5em; background-color: #ffffff;"&gt;The value -1 indicates that the matching pattern replacement should happen till the end of string is reached. If 1 is used the replacement ends when the first match is found.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-size: 13.4399995803833px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-size: 13.4399995803833px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 15:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Replacing-with-Spaces/m-p/141594#M37790</guid>
      <dc:creator>archcnu</dc:creator>
      <dc:date>2015-01-29T15:06:07Z</dc:date>
    </item>
  </channel>
</rss>

