<?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 concatenation and extra spaces in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concatenation-and-extra-spaces/m-p/98761#M257945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; first = 'Ipswich, England';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; city = substr(first,1,7);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; city_country = city||', '||'England';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how come city_country = 'Ipswich , England'?&lt;/P&gt;&lt;P&gt;where did the space between 'Ipswich' and the comma&amp;nbsp; come from?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Oct 2012 21:34:07 GMT</pubDate>
    <dc:creator>Davidliu494</dc:creator>
    <dc:date>2012-10-17T21:34:07Z</dc:date>
    <item>
      <title>concatenation and extra spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenation-and-extra-spaces/m-p/98761#M257945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; first = 'Ipswich, England';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; city = substr(first,1,7);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; city_country = city||', '||'England';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how come city_country = 'Ipswich , England'?&lt;/P&gt;&lt;P&gt;where did the space between 'Ipswich' and the comma&amp;nbsp; come from?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 21:34:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenation-and-extra-spaces/m-p/98761#M257945</guid>
      <dc:creator>Davidliu494</dc:creator>
      <dc:date>2012-10-17T21:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: concatenation and extra spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenation-and-extra-spaces/m-p/98762#M257946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What length did you expect that the SAS would use to create the variable CITY ?&amp;nbsp; It makes it length $16 since the variable FIRST was defaulted to $16 based on the length of the string literal first assigned to it.&amp;nbsp;&amp;nbsp; Hence there are 11 spaces at the end of the variable after the 7 that you populated with the SUBSTR() function call.&lt;/P&gt;&lt;P&gt;Use CATS or CATX function instead to have SAS strip the spaces off the end of the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data test2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; first = 'Ipswich, England';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; city = substr(first,1,7);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; city_country = city||', '||'England';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fix = catx(', ',city,'England';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; put (_all_) (/ $quote.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;"Ipswich, England"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;"Ipswich"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;"Ipswich&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , England"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;"Ipswich, England"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NOTE: The data set WORK.TEST2 has 1 observations and 4 variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 21:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenation-and-extra-spaces/m-p/98762#M257946</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-17T21:48:37Z</dc:date>
    </item>
  </channel>
</rss>

