<?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 combine observations by separator in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/combine-observations-by-separator/m-p/71403#M20615</link>
    <description>Hi, Below is the input dataset1 which needs to be transformed to dataset2. &lt;BR /&gt;
Is there a simpler way to do this, please comment.&lt;BR /&gt;
&lt;BR /&gt;
dataset1&lt;BR /&gt;
======&lt;BR /&gt;
KEY	VALUE&lt;BR /&gt;
100	VALUE1,VALUE1A&lt;BR /&gt;
100	VALUE2,VALUE2A&lt;BR /&gt;
100	VALUE3,VALUE3A&lt;BR /&gt;
200	VALUE11,VALUE1B&lt;BR /&gt;
200	VALUE12,VALUE2B&lt;BR /&gt;
300	VALUE23,VALUE1C&lt;BR /&gt;
&lt;BR /&gt;
dataset2&lt;BR /&gt;
======&lt;BR /&gt;
KEY	NEW_VALUE&lt;BR /&gt;
100	VALUE1,VALUE1A,VALUE2,VALUE2A,VALUE3,VALUE3A&lt;BR /&gt;
200	VALUE11,VALUE1B,VALUE12,VALUE2B&lt;BR /&gt;
300	VALUE23,VALUE1C</description>
    <pubDate>Tue, 27 Jan 2009 15:59:48 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-01-27T15:59:48Z</dc:date>
    <item>
      <title>combine observations by separator</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/combine-observations-by-separator/m-p/71403#M20615</link>
      <description>Hi, Below is the input dataset1 which needs to be transformed to dataset2. &lt;BR /&gt;
Is there a simpler way to do this, please comment.&lt;BR /&gt;
&lt;BR /&gt;
dataset1&lt;BR /&gt;
======&lt;BR /&gt;
KEY	VALUE&lt;BR /&gt;
100	VALUE1,VALUE1A&lt;BR /&gt;
100	VALUE2,VALUE2A&lt;BR /&gt;
100	VALUE3,VALUE3A&lt;BR /&gt;
200	VALUE11,VALUE1B&lt;BR /&gt;
200	VALUE12,VALUE2B&lt;BR /&gt;
300	VALUE23,VALUE1C&lt;BR /&gt;
&lt;BR /&gt;
dataset2&lt;BR /&gt;
======&lt;BR /&gt;
KEY	NEW_VALUE&lt;BR /&gt;
100	VALUE1,VALUE1A,VALUE2,VALUE2A,VALUE3,VALUE3A&lt;BR /&gt;
200	VALUE11,VALUE1B,VALUE12,VALUE2B&lt;BR /&gt;
300	VALUE23,VALUE1C</description>
      <pubDate>Tue, 27 Jan 2009 15:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/combine-observations-by-separator/m-p/71403#M20615</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-01-27T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: combine observations by separator</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/combine-observations-by-separator/m-p/71404#M20616</link>
      <description>Hi:&lt;BR /&gt;
  There are some very good PROC TRANSPOSE examples in the documentation -- they wouldn't get you to this output immediately (initially, you'd have COL1, COL2, COL3, COL4, etc, etc instead of NEW_VALUE), but then you could use an ARRAY to create the new variable. Or you could just use BY group processing with the RETAIN statement to construct dataset2 from dataset1.&lt;BR /&gt;
  &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 27 Jan 2009 17:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/combine-observations-by-separator/m-p/71404#M20616</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-01-27T17:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: combine observations by separator</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/combine-observations-by-separator/m-p/71405#M20617</link>
      <description>Hi Kumar,&lt;BR /&gt;
&lt;BR /&gt;
Please try this code.It will be giving exact output.&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
input KEY VALUE$ 15.;&lt;BR /&gt;
cards;&lt;BR /&gt;
100 VALUE1,VALUE1A&lt;BR /&gt;
100 VALUE2,VALUE2A&lt;BR /&gt;
100 VALUE3,VALUE3A&lt;BR /&gt;
200 VALUE11,VALUE1B&lt;BR /&gt;
200 VALUE12,VALUE2B&lt;BR /&gt;
300 VALUE23,VALUE1C&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc transpose data=one out=two;&lt;BR /&gt;
var value;&lt;BR /&gt;
by key;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data three(drop=_Name_ col1 col2 col3);&lt;BR /&gt;
set two;&lt;BR /&gt;
new_column=col1||","||col2||","||col3;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 02 Feb 2009 06:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/combine-observations-by-separator/m-p/71405#M20617</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-02T06:06:33Z</dc:date>
    </item>
  </channel>
</rss>

