<?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 over rows and then remerge it in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concatenate-over-rows-and-then-remerge-it/m-p/601926#M174192</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    do until (last.id);
        set tbl;
        length con $ 200;
        by id;
        if not missing(Loc) then con=catx(',', con, Loc);
    end;
    do until (last.id);
        set tbl;
        by id;
        output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID   Loc   con
1          3,5
1          3,5
1    3     3,5
1          3,5
1    5     3,5
2    3
2    3
2    3     3
2    3
2    3
3  
3  
3  
3  
3  &lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Nov 2019 10:16:12 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-11-06T10:16:12Z</dc:date>
    <item>
      <title>concatenate over rows and then remerge it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-over-rows-and-then-remerge-it/m-p/601920#M174189</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have a row data that contain multiple rows per customer.&lt;/P&gt;
&lt;P&gt;I want to concatenate the values in column&amp;nbsp; "Loc" and the remerge it with original data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
input ID  Loc $;
cards;
1 .
1 .
1 3
1 .
1 5
2 .
2 .
2 3
2 .
2 .
3 .
3 .
3 .
3 .
3 .
;
run;
/*Required data set*/
/*1 .  3,5*/
/*1 .  3,5*/
/*1 3  3,5*/
/*1 .  3,5*/
/*1 5  3,5*/
/*2 .  3*/
/*2 .  3 */
/*2 3  3*/
/*2 .  .*/
/*2 .  .*/
/*3 .  .*/
/*3 .  .*/
/*3 .  .*/
/*3 .  .*/
/*3 .  .*/
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Nov 2019 10:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-over-rows-and-then-remerge-it/m-p/601920#M174189</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-11-06T10:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate over rows and then remerge it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-over-rows-and-then-remerge-it/m-p/601923#M174190</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;did you find your answer to your previous thread?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/calculate-number-of-distinct-values-between-rows-for-each/m-p/601887" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/calculate-number-of-distinct-values-between-rows-for-each/m-p/601887&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, please remember to close the thread.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 10:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-over-rows-and-then-remerge-it/m-p/601923#M174190</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-06T10:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate over rows and then remerge it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-over-rows-and-then-remerge-it/m-p/601926#M174192</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    do until (last.id);
        set tbl;
        length con $ 200;
        by id;
        if not missing(Loc) then con=catx(',', con, Loc);
    end;
    do until (last.id);
        set tbl;
        by id;
        output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID   Loc   con
1          3,5
1          3,5
1    3     3,5
1          3,5
1    5     3,5
2    3
2    3
2    3     3
2    3
2    3
3  
3  
3  
3  
3  &lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Nov 2019 10:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-over-rows-and-then-remerge-it/m-p/601926#M174192</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-06T10:16:12Z</dc:date>
    </item>
  </channel>
</rss>

