<?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: How to transpose &amp;amp; combine a text field with multiple values for each ID? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-amp-combine-a-text-field-with-multiple-values/m-p/564309#M158271</link>
    <description>&lt;P&gt;It is pretty trivial. Note that you will need to make a NEW variable to hold the list. You will probably need to make it longer than the original variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID Category $20.;
cards;
1 Dog
1 Cat
2 Horse
3 Dog
3 Horse
3 Cat
;

data want ;
  do until (last.id);
    set have;
    by id;
    length new_category $200 ;
    new_category=catx(' + ',new_category,category);
  end;
  drop category;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    ID    new_category

 1      1    Dog + Cat
 2      2    Horse
 3      3    Dog + Horse + Cat&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Jun 2019 21:03:40 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-06-06T21:03:40Z</dc:date>
    <item>
      <title>How to transpose &amp; combine a text field with multiple values for each ID?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-amp-combine-a-text-field-with-multiple-values/m-p/564307#M158270</link>
      <description>&lt;P&gt;Here is what I have:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ID Category
1 Dog
1 Cat
2 Horse
3 Dog
3 Horse
3 Cat&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And what I need is something along the lines of this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ID Category
1 Dog + Cat
2 Horse
3 Dog + Cat + Horse&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can think of some very roundabout ways to do this but there has to be a simple quick way. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 20:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-amp-combine-a-text-field-with-multiple-values/m-p/564307#M158270</guid>
      <dc:creator>pfdjadsfdsafas</dc:creator>
      <dc:date>2019-06-06T20:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose &amp; combine a text field with multiple values for each ID?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-amp-combine-a-text-field-with-multiple-values/m-p/564309#M158271</link>
      <description>&lt;P&gt;It is pretty trivial. Note that you will need to make a NEW variable to hold the list. You will probably need to make it longer than the original variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID Category $20.;
cards;
1 Dog
1 Cat
2 Horse
3 Dog
3 Horse
3 Cat
;

data want ;
  do until (last.id);
    set have;
    by id;
    length new_category $200 ;
    new_category=catx(' + ',new_category,category);
  end;
  drop category;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    ID    new_category

 1      1    Dog + Cat
 2      2    Horse
 3      3    Dog + Horse + Cat&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jun 2019 21:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-amp-combine-a-text-field-with-multiple-values/m-p/564309#M158271</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-06T21:03:40Z</dc:date>
    </item>
  </channel>
</rss>

