<?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: Merging row text by ID in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666483#M199422</link>
    <description>Thank you Sir</description>
    <pubDate>Wed, 01 Jul 2020 20:41:55 GMT</pubDate>
    <dc:creator>rajd1</dc:creator>
    <dc:date>2020-07-01T20:41:55Z</dc:date>
    <item>
      <title>Merging row text by ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666473#M199415</link>
      <description>&lt;P&gt;Hi, I am working with some textual data and i want to combine textual rows by ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data have:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl63" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;alpha&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;b&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;c&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;c&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;b&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Want:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" align="right" style="height: 15.0pt; width: 48pt;"&gt;1&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;a,b,c&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD&gt;a,c&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD&gt;a,b&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD&gt;a&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 20:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666473#M199415</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-07-01T20:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Merging row text by ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666475#M199416</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input ID	alpha $;
cards;
1	a
1	b
1	c
2	a
2	c
3	a
3	b
4	a
;

data want;
 do until(last.id);
  set have;
  by id;
  length want $100;
  want=catx(',',want,alpha);
 end;
 drop alpha;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Jul 2020 20:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666475#M199416</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-07-01T20:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Merging row text by ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666482#M199421</link>
      <description>&lt;P&gt;The following code will help you.&lt;/P&gt;
&lt;PRE&gt;data want(Keep = id newvar);
length newvar $200.;
set have;
by ID;
retain newvar;
if first.ID then newvar=alpha;
else newvar=catx(',',newvar,alpha);
if last.ID;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 20:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666482#M199421</guid>
      <dc:creator>Sathish_jammy</dc:creator>
      <dc:date>2020-07-01T20:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Merging row text by ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666483#M199422</link>
      <description>Thank you Sir</description>
      <pubDate>Wed, 01 Jul 2020 20:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666483#M199422</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-07-01T20:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Merging row text by ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666484#M199423</link>
      <description>Thanks a lot!</description>
      <pubDate>Wed, 01 Jul 2020 20:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666484#M199423</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-07-01T20:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Merging row text by ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666498#M199428</link>
      <description>&lt;LI-CODE lang="markup"&gt;data have;
input ID	alpha $;
cards;
1	a
1	b
1	c
2	a
2	c
3	a
3	b
4	a
4      a
;

data want;
 do until(last.id);
  set have;
  by id;
  length want $100;
  want=catx(',',want,alpha);
 end;
 drop alpha;
run;&lt;/LI-CODE&gt;
&lt;P&gt;Just a minor addition: What if i had the same alpha for the same id. For example id#4 has a and a twice. I just want it to be displaced as 'a' instead of 'a,a'&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 22:01:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666498#M199428</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-07-01T22:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Merging row text by ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666500#M199430</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/331278"&gt;@rajd1&lt;/a&gt;&amp;nbsp; Please try the modified and let me know-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input ID	alpha $;
cards;
1	a
1	b
1	c
2	a
2	c
3	a
3	b
4	a
4      a
;

data want;
 do until(last.id);
  set have;
  by id;
  length want $100;
  if ^index(want,strip(alpha)) then want=catx(',',want,alpha);
 end;
 drop alpha;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Jul 2020 22:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-row-text-by-ID/m-p/666500#M199430</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-07-01T22:43:30Z</dc:date>
    </item>
  </channel>
</rss>

