<?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 combine 2 char columns and add a comma separator in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416205#M26771</link>
    <description>&lt;P&gt;SAS now has a lot of interesting CAT....() functions.&lt;/P&gt;
&lt;P&gt;CATX() is useful in this case.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;field1=catx(',',field1,field2);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 26 Nov 2017 18:19:34 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-11-26T18:19:34Z</dc:date>
    <item>
      <title>How to combine 2 char columns and add a comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416187#M26768</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm new to using EG and I'm amending a flow built by someone who has since left. It's EG 4.3 (so a bit elderly) and the input dataset structure has changed since the flow was originally built.. I'm trying to combine address data to fit and it seems simple enough but I'm struggling. Any help that I can try would be gratefully received please!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data example:&lt;/P&gt;&lt;P&gt;Field 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Field 2&lt;/P&gt;&lt;P&gt;14 Anywhere Street, Town, County &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; LR12 6HG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to add the postcode into the same field as the first part of the address but with a comma after the county and before the postcode. The output should look like:&lt;/P&gt;&lt;P&gt;Field 1&lt;/P&gt;&lt;P&gt;14 Anywhere Street, Town, County, LR12 6HG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output will be feeding into a subsequent code node so has to have the correct input structure or it fails. I don't know how to SAS code to try and amend the code node so I'm stuck! I've found heaps of guidance for removing commas but not for adding one in.&lt;/P&gt;&lt;P&gt;Many thanks&amp;nbsp;&lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://communities.sas.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 12:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416187#M26768</guid>
      <dc:creator>Misted5</dc:creator>
      <dc:date>2017-11-26T12:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine 2 char columns and add a comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416190#M26769</link>
      <description>&lt;P&gt;Just concatenate, but take care of trailing blanks:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;field1 = trim(field1) !! ', ' !! field2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that field1 needs to be defined with a length sufficent to hold the concatenated values, so you might need to create a new variable, as you can't change the length of a variable on-the-fly.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 13:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416190#M26769</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-26T13:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine 2 char columns and add a comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416193#M26770</link>
      <description>&lt;P&gt;Ah thank you very much, I haven't used trim before - I'll try this when I'm back in work tomorrow&amp;nbsp;&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;</description>
      <pubDate>Sun, 26 Nov 2017 14:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416193#M26770</guid>
      <dc:creator>Misted5</dc:creator>
      <dc:date>2017-11-26T14:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine 2 char columns and add a comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416205#M26771</link>
      <description>&lt;P&gt;SAS now has a lot of interesting CAT....() functions.&lt;/P&gt;
&lt;P&gt;CATX() is useful in this case.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;field1=catx(',',field1,field2);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Nov 2017 18:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416205#M26771</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-26T18:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine 2 char columns and add a comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416246#M26772</link>
      <description>&lt;P&gt;Regardless of the approach you take, one of the issues to consider is the lengths of the variables involved.&amp;nbsp; Make sure FIELD1 is long enough to hold the combined values (otherwise it is possible to lose characters from the end of the combined string).&amp;nbsp; If you need to adjust the length of FIELD1, do it before the SET statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;length field1 $ 100;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;*** whatever approach you choose;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 04:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416246#M26772</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-11-27T04:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine 2 char columns and add a comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416496#M26797</link>
      <description>&lt;P&gt;Thank you all for your quick help, it was much appreciated. I hadn't thought about the length of the field, and when I checked it was auto-set to 200 characters so plenty of room but by luck rather than judgement.&lt;/P&gt;&lt;P&gt;Thanks again&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 20:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-combine-2-char-columns-and-add-a-comma-separator/m-p/416496#M26797</guid>
      <dc:creator>Misted5</dc:creator>
      <dc:date>2017-11-27T20:10:58Z</dc:date>
    </item>
  </channel>
</rss>

