<?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: Concatenate values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658020#M197196</link>
    <description>&lt;P&gt;If a company has 3000 employees or more, you will overflow the maximum length of character variables, unless your rule for concatenating is different than what it seems to be in your example.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2020 11:27:55 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-06-12T11:27:55Z</dc:date>
    <item>
      <title>Concatenate values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/657972#M197192</link>
      <description>&lt;P&gt;Team could you please help me out with the below problem&lt;/P&gt;
&lt;P&gt;Eg: I have the below table&lt;/P&gt;
&lt;P&gt;Company&amp;nbsp; &amp;nbsp; ID&amp;nbsp; &amp;nbsp; &amp;nbsp;DESIGNATION&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Employee&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; Supervisor&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; Manager&lt;/P&gt;
&lt;P&gt;I wanted&amp;nbsp; the data to be concatenated as below in one variable, the new_var should have id concatenated with designation, can you please help me out&lt;/P&gt;
&lt;P&gt;Company&amp;nbsp; &amp;nbsp; ID&amp;nbsp; &amp;nbsp; &amp;nbsp;DESIGNATION&amp;nbsp; &amp;nbsp;New_var&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Employee&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1-Employee, 1-Supervisor, 2-Manager&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 11:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/657972#M197192</guid>
      <dc:creator>Lokesh4</dc:creator>
      <dc:date>2020-06-12T11:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a data step version of your data AKA generate sample data for forums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658015#M197193</link>
      <description>&lt;DIV class="lia-message-body-wrapper lia-component-message-view-widget-body"&gt;
&lt;DIV id="bodyDisplay_17" class="lia-message-body"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/333431" target="_blank"&gt;@Lokesh4&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Welcome to the SAS community!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why on earth did you post a new question after an unrelated discussion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As importantly, did you even read what the discussion is about?&lt;/P&gt;
&lt;P&gt;It is about posting your sample data in the correct format, which you -very ironically- have not done!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Moving the question from &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/tac-p/657972#M4749" target="_self"&gt;here&lt;/A&gt; to the programming forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Jun 2020 11:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658015#M197193</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-12T11:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658017#M197195</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/333431"&gt;@Lokesh4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Team could you please help me out with the below problem&lt;/P&gt;
&lt;P&gt;Eg: I have the below table&lt;/P&gt;
&lt;P&gt;Company&amp;nbsp; &amp;nbsp; ID&amp;nbsp; &amp;nbsp; &amp;nbsp;DESIGNATION&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Employee&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; Supervisor&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; Manager&lt;/P&gt;
&lt;P&gt;I wanted&amp;nbsp; the data to be concatenated as below in one variable, the new_var should have id concatenated with designation, can you please help me out&lt;/P&gt;
&lt;P&gt;Company&amp;nbsp; &amp;nbsp; ID&amp;nbsp; &amp;nbsp; &amp;nbsp;DESIGNATION&amp;nbsp; &amp;nbsp;New_var&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Employee&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1-Employee, 1-Supervisor, 2-Manager&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The output you want is not consistent with the Input. ID 1 has only two records in the input, yet in the output it seems as if you are concatenating three records for ID 1. Could you please clarify this? Also, where does DESIGNATION come from?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, concatenating long data sets into wide data as you are asking to do is rarely necessary and rarely a good thing to do. What will you be doing with this variable NEW_VAR?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 11:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658017#M197195</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-06-12T11:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658020#M197196</link>
      <description>&lt;P&gt;If a company has 3000 employees or more, you will overflow the maximum length of character variables, unless your rule for concatenating is different than what it seems to be in your example.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 11:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658020#M197196</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-12T11:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658091#M197223</link>
      <description>&lt;P&gt;Hello &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/333431" target="_blank" rel="noopener"&gt;@Lokesh4&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whatever your need is, here you have it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input Company $ ID Designation $;
Datalines;
ABC 1 Employee
ABC 1 Supervisor
ABC 2 Manager
run;

Data want;
set test;
new_var= CATX('-',ID,Designation);
run;&lt;BR /&gt;&lt;BR /&gt;/*The result below*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result.PNG" style="width: 262px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42850i524E53F59F4B946C/image-size/large?v=v2&amp;amp;px=999" role="button" title="result.PNG" alt="result.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-values/m-p/658091#M197223</guid>
      <dc:creator>CarlosSpranger</dc:creator>
      <dc:date>2020-06-12T14:50:25Z</dc:date>
    </item>
  </channel>
</rss>

