<?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 remove multiple spaces between words in a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-multiple-spaces-between-words-in-a-string/m-p/966104#M376023</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;I have a string values in a dataset that I would like to cleanup so there's only one space between each word.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some cases where there's two spaces so it's creating a separate value.&lt;/P&gt;
&lt;P&gt;Here's an example:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LRogers_1-1746728623982.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106820i7704B06E7F3D9663/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LRogers_1-1746728623982.png" alt="LRogers_1-1746728623982.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The first one has multiple spaces between "IT" and&amp;nbsp; "INC", whereas the second one just has one space (desired).&lt;/P&gt;
&lt;P&gt;I've researched trim, strip, compress - having trouble finding the solution.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;P.S I'm using Enterprise Guide&lt;/P&gt;</description>
    <pubDate>Thu, 08 May 2025 18:29:03 GMT</pubDate>
    <dc:creator>LRogers</dc:creator>
    <dc:date>2025-05-08T18:29:03Z</dc:date>
    <item>
      <title>remove multiple spaces between words in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-multiple-spaces-between-words-in-a-string/m-p/966104#M376023</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;I have a string values in a dataset that I would like to cleanup so there's only one space between each word.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some cases where there's two spaces so it's creating a separate value.&lt;/P&gt;
&lt;P&gt;Here's an example:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LRogers_1-1746728623982.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106820i7704B06E7F3D9663/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LRogers_1-1746728623982.png" alt="LRogers_1-1746728623982.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The first one has multiple spaces between "IT" and&amp;nbsp; "INC", whereas the second one just has one space (desired).&lt;/P&gt;
&lt;P&gt;I've researched trim, strip, compress - having trouble finding the solution.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;P.S I'm using Enterprise Guide&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 18:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-multiple-spaces-between-words-in-a-string/m-p/966104#M376023</guid>
      <dc:creator>LRogers</dc:creator>
      <dc:date>2025-05-08T18:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: remove multiple spaces between words in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-multiple-spaces-between-words-in-a-string/m-p/966105#M376024</link>
      <description>&lt;P&gt;I doubt if Enterprise Guide has any GUI tools to handle this, so just write normal SAS code instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the white spaces are actual tabs just use the COMPBL() function to collapse the multiple adjacent spaces into one.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;string=compbl(string);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you also need to remove leading spaces use LEFT() function.&amp;nbsp; Don't worry about trailing spaces, SAS variables are fixed length and padded with spaces, so any trailing spaces you remove will just reappear once you store the value back into a variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 18:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-multiple-spaces-between-words-in-a-string/m-p/966105#M376024</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-05-08T18:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: remove multiple spaces between words in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-multiple-spaces-between-words-in-a-string/m-p/966106#M376025</link>
      <description>&lt;P&gt;Try the COMPBL function.&amp;nbsp; From the docs:&lt;BR /&gt;"&lt;SPAN&gt;The COMPBL function removes multiple blanks in a character string by translating each occurrence of two or more consecutive blanks into a single blank."&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 18:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-multiple-spaces-between-words-in-a-string/m-p/966106#M376025</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-05-08T18:46:01Z</dc:date>
    </item>
  </channel>
</rss>

