<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462286#M117677</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;May you send it please by code?&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I will gladly &lt;EM&gt;help&lt;/EM&gt; you with your code, but if you want me to do your work for you, you need to hire me. Write code along my suggestions, and post it (along with the log) if you encounter problems.&lt;/P&gt;</description>
    <pubDate>Tue, 15 May 2018 07:32:28 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-05-15T07:32:28Z</dc:date>
    <item>
      <title>Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462268#M117666</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have a raw data table that each customer appreas in a few rows.&lt;/P&gt;&lt;P&gt;I want to create a new table that each customer apperars in 1 row only and create a &amp;nbsp;new field that have vector of values with comma delmiter between them.&lt;/P&gt;&lt;P&gt;For exmaple:&lt;/P&gt;&lt;P&gt;Data aaa;&lt;BR /&gt;Input ID Stop $;&lt;BR /&gt;Cards;&lt;BR /&gt;1 S1&lt;BR /&gt;1 S9&lt;BR /&gt;1 S15&lt;BR /&gt;1 S22&lt;BR /&gt;2 S3&lt;BR /&gt;2 S7&lt;BR /&gt;2 S12&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Desired table&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;S1,S9,S15,S22&lt;/P&gt;&lt;P&gt;2 &amp;nbsp;S3,S7,S12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 06:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462268#M117666</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-05-15T06:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462276#M117671</link>
      <description>&lt;UL&gt;
&lt;LI&gt;use a data step with by id;&lt;/LI&gt;
&lt;LI&gt;retain a character variable and define it with sufficient length&lt;/LI&gt;
&lt;LI&gt;at first.id, set it to empty&lt;/LI&gt;
&lt;LI&gt;use catx(',',stops,stop) to concatenate&lt;/LI&gt;
&lt;LI&gt;at last.id, output&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 15 May 2018 07:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462276#M117671</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-15T07:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462277#M117672</link>
      <description>&lt;P&gt;May you send it please by code?&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 07:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462277#M117672</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-05-15T07:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462283#M117674</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Should I use proc sql with group by?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 07:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462283#M117674</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-05-15T07:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462284#M117675</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=aaa;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;by ID;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data bbb;
	length ID 8 concat $200;
	set aaa;
	retain concat;
	by ID;
	if first.ID then concat = "";
	concat = catx(',',Stop,concat);
	if last.ID then output;
	drop Stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;FloT&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 07:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462284#M117675</guid>
      <dc:creator>FloT</dc:creator>
      <dc:date>2018-05-15T07:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462285#M117676</link>
      <description>&lt;P&gt;Do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data aaa;
Input ID Stop $;
Cards;
1 S1
1 S9
1 S15
1 S22
2 S3
2 S7
2 S12
;
Run;

data want;
	length ID 8 ConcStop $100;
	set aaa;
	by ID;
	if first.ID then ConcStop = "";
	ConcStop = catx(',',Stop, ConcStop);
	if last.ID;
    retain ConcStop;drop Stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 May 2018 07:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462285#M117676</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-05-15T07:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462286#M117677</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;May you send it please by code?&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I will gladly &lt;EM&gt;help&lt;/EM&gt; you with your code, but if you want me to do your work for you, you need to hire me. Write code along my suggestions, and post it (along with the log) if you encounter problems.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 07:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462286#M117677</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-15T07:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462287#M117678</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549" target="_self"&gt;Ronein&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Below code help you to get desired output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Desired;&lt;BR /&gt;length cat $50.;&lt;BR /&gt;do until (last.ID);&lt;BR /&gt;set aaa;&lt;BR /&gt;by ID notsorted;&lt;BR /&gt;cat=catx(',',cat,Stop);&lt;BR /&gt;end;&lt;BR /&gt;drop Stop;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 07:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462287#M117678</guid>
      <dc:creator>rajiv436</dc:creator>
      <dc:date>2018-05-15T07:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462288#M117679</link>
      <description>&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=aaa;By&amp;nbsp;&lt;SPAN&gt;ID &lt;/SPAN&gt;&lt;SPAN&gt;Stop;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;bbb;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;aaa;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;Vect;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;ID Stop;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; concat &lt;/FONT&gt;&lt;FONT face="Courier New" color="#008080"&gt;$30.&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; first.ID &amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; &lt;SPAN&gt;Vect&lt;/SPAN&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" color="#800080"&gt;""&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;Vect&lt;/SPAN&gt;=catx(&lt;/FONT&gt;&lt;FONT face="Courier New" color="#800080"&gt;'/'&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;,trim(&lt;SPAN&gt;Vect&lt;/SPAN&gt;),trim(stop));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; last.&lt;SPAN&gt;ID &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;then&lt;/FONT&gt; &lt;FONT face="Courier New" color="#0000ff"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 07:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462288#M117679</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-05-15T07:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462290#M117681</link>
      <description>&lt;P&gt;Three issues:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the by statement only needs id&lt;/LI&gt;
&lt;LI&gt;set the length for Vect instead of concat&lt;/LI&gt;
&lt;LI&gt;catx does the trimming (actually stirpping) of variables on its own, so you don't need to do it&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Since stop is not needed anymore in the output, you can drop it.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 07:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462290#M117681</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-15T07:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462364#M117711</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Good morning , That's so neat and textbook style. My mates at my college took those notes printed for their future reference. Just an acknowledgement for all of us.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 14:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462364#M117711</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-15T14:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462369#M117712</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Good morning , That's so neat and textbook style. My mates at my college took those notes printed for their future reference. Just an acknowledgement for all of us.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I feel flattered.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 14:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate/m-p/462369#M117712</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-15T14:36:23Z</dc:date>
    </item>
  </channel>
</rss>

