<?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 Connect cell in column based on condition in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Connect-cell-in-column-based-on-condition/m-p/16385#M3000</link>
    <description>Hi &lt;BR /&gt;
can somebody help me with this.&lt;BR /&gt;
Data:&lt;BR /&gt;
&lt;BR /&gt;
Name	code	operations	CNT&lt;BR /&gt;
Bob	A	20	1&lt;BR /&gt;
Bob	B	20	2&lt;BR /&gt;
Bob	B	30	3&lt;BR /&gt;
Bob	D	40	4&lt;BR /&gt;
John	A	20	1&lt;BR /&gt;
John	A	20	2&lt;BR /&gt;
John	B	30	3&lt;BR /&gt;
John	C	30	4&lt;BR /&gt;
&lt;BR /&gt;
What I want is to connect cell in column code(comma delimited) if name and operations are same like in example below:&lt;BR /&gt;
&lt;BR /&gt;
Name	code	operations	&lt;BR /&gt;
Bob	A,B	20	&lt;BR /&gt;
Bob	B	30	&lt;BR /&gt;
Bob	D	40	&lt;BR /&gt;
John	A,A	20	&lt;BR /&gt;
John	B,C	30	&lt;BR /&gt;
&lt;BR /&gt;
Thank you in advance&lt;BR /&gt;
Bob

Message was edited by: bob021</description>
    <pubDate>Thu, 24 Feb 2011 08:28:09 GMT</pubDate>
    <dc:creator>bob021</dc:creator>
    <dc:date>2011-02-24T08:28:09Z</dc:date>
    <item>
      <title>Connect cell in column based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Connect-cell-in-column-based-on-condition/m-p/16385#M3000</link>
      <description>Hi &lt;BR /&gt;
can somebody help me with this.&lt;BR /&gt;
Data:&lt;BR /&gt;
&lt;BR /&gt;
Name	code	operations	CNT&lt;BR /&gt;
Bob	A	20	1&lt;BR /&gt;
Bob	B	20	2&lt;BR /&gt;
Bob	B	30	3&lt;BR /&gt;
Bob	D	40	4&lt;BR /&gt;
John	A	20	1&lt;BR /&gt;
John	A	20	2&lt;BR /&gt;
John	B	30	3&lt;BR /&gt;
John	C	30	4&lt;BR /&gt;
&lt;BR /&gt;
What I want is to connect cell in column code(comma delimited) if name and operations are same like in example below:&lt;BR /&gt;
&lt;BR /&gt;
Name	code	operations	&lt;BR /&gt;
Bob	A,B	20	&lt;BR /&gt;
Bob	B	30	&lt;BR /&gt;
Bob	D	40	&lt;BR /&gt;
John	A,A	20	&lt;BR /&gt;
John	B,C	30	&lt;BR /&gt;
&lt;BR /&gt;
Thank you in advance&lt;BR /&gt;
Bob

Message was edited by: bob021</description>
      <pubDate>Thu, 24 Feb 2011 08:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Connect-cell-in-column-based-on-condition/m-p/16385#M3000</guid>
      <dc:creator>bob021</dc:creator>
      <dc:date>2011-02-24T08:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Connect cell in column based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Connect-cell-in-column-based-on-condition/m-p/16386#M3001</link>
      <description>OK. It is easy.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
input Name $ code $ operations CNT;&lt;BR /&gt;
cards;&lt;BR /&gt;
Bob A 20 1&lt;BR /&gt;
Bob B 20 2&lt;BR /&gt;
Bob B 30 3&lt;BR /&gt;
Bob D 40 4&lt;BR /&gt;
John A 20 1&lt;BR /&gt;
John A 20 2&lt;BR /&gt;
John B 30 3&lt;BR /&gt;
John C 30 4&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=temp;&lt;BR /&gt;
 by name operations;&lt;BR /&gt;
run;&lt;BR /&gt;
data result;&lt;BR /&gt;
 set temp;&lt;BR /&gt;
 by name operations;&lt;BR /&gt;
 length _code $ 10;&lt;BR /&gt;
 retain _code;&lt;BR /&gt;
 if first.operations then call missing(_code);&lt;BR /&gt;
 _code=catx(',',_code,code);&lt;BR /&gt;
 if last.operations then output;&lt;BR /&gt;
 keep name _code operations;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 24 Feb 2011 09:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Connect-cell-in-column-based-on-condition/m-p/16386#M3001</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-24T09:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Connect cell in column based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Connect-cell-in-column-based-on-condition/m-p/16387#M3002</link>
      <description>Hello Ksharp &lt;BR /&gt;
Thank you very much working like a charm. &lt;BR /&gt;
Bob</description>
      <pubDate>Thu, 24 Feb 2011 10:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Connect-cell-in-column-based-on-condition/m-p/16387#M3002</guid>
      <dc:creator>bob021</dc:creator>
      <dc:date>2011-02-24T10:13:08Z</dc:date>
    </item>
  </channel>
</rss>

