<?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: Concat the data in single cell in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754340#M237861</link>
    <description>&lt;P&gt;What is the maximum number of activity or frequency values that could ever be expected to end up in single cell?&lt;/P&gt;
&lt;P&gt;You kind of need to know that to allocate a variable long enough to hold that many values plus space for commas and spaces between the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, just what do you expect to do with that data structure that you can't do with the current one?&lt;/P&gt;
&lt;P&gt;(It is sort of amazing how many times I get no answer to this question for basically the same data mangling)&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 14:22:22 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-07-15T14:22:22Z</dc:date>
    <item>
      <title>Concat the data in single cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754327#M237849</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have to concat the information given in different cell with same ID and Date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
input ID Dt mmddyy10. Activity:$30. Act_freq:$30.;
cards;
123	12/19/2010 Walking Daily
123	12/19/2010 NormalWalking Daily
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For instance: Have:&lt;/P&gt;
&lt;TABLE width="450"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;ID&amp;nbsp;&lt;/TD&gt;
&lt;TD width="109"&gt;Date&lt;/TD&gt;
&lt;TD width="181"&gt;Activity&lt;/TD&gt;
&lt;TD width="96"&gt;Act_freq&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;123&lt;/TD&gt;
&lt;TD&gt;19-12-2010&lt;/TD&gt;
&lt;TD&gt;Walking&lt;/TD&gt;
&lt;TD&gt;Daily&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;123&lt;/TD&gt;
&lt;TD&gt;19-12-2010&lt;/TD&gt;
&lt;TD&gt;NormalWalking&lt;/TD&gt;
&lt;TD&gt;Daily&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Want:&lt;/P&gt;
&lt;TABLE width="541"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;ID&amp;nbsp;&lt;/TD&gt;
&lt;TD width="109"&gt;Date&lt;/TD&gt;
&lt;TD width="272"&gt;Activity&lt;/TD&gt;
&lt;TD width="96"&gt;Act_freq&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;123&lt;/TD&gt;
&lt;TD&gt;19-12-2010&lt;/TD&gt;
&lt;TD&gt;Walking, NormalWalking&lt;/TD&gt;
&lt;TD&gt;Daily, Daily&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kindly suggest a code to get this format.&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 13:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754327#M237849</guid>
      <dc:creator>Sathish_jammy</dc:creator>
      <dc:date>2021-07-15T13:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Concat the data in single cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754331#M237853</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
input ID Dt mmddyy10. Activity:$30. Act_freq:$30.;
format dt mmddyy10.;
cards;
123	12/19/2010 Walking Daily
123	12/19/2010 NormalWalking Daily
run;

data want ;
  do until(last.dt) ;
    set have ;
    by id dt ;
    length _activity _Act_freq  $100 ;
    _activity=catx(', ', _activity, activity) ;
    _Act_freq=catx(', ',_Act_freq, Act_freq) ;
  end ;
  drop activity Act_freq;
  rename _Act_freq=Act_freq _activity=activity ;
run ;

proc print noobs ; run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;RESULT:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;ID&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Dt&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;activity&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Act_freq&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;123&lt;/TD&gt;
&lt;TD class="r data"&gt;12/19/2010&lt;/TD&gt;
&lt;TD class="l data"&gt;Walking, NormalWalking&lt;/TD&gt;
&lt;TD class="l data"&gt;Daily, Daily&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754331#M237853</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-07-15T14:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Concat the data in single cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754333#M237855</link>
      <description>&lt;P&gt;I don't really know what you intend to do with this data, but I think anything you could possibly do with this data in SAS would be easier to do if you left the data in the original format.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754333#M237855</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-15T14:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Concat the data in single cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754340#M237861</link>
      <description>&lt;P&gt;What is the maximum number of activity or frequency values that could ever be expected to end up in single cell?&lt;/P&gt;
&lt;P&gt;You kind of need to know that to allocate a variable long enough to hold that many values plus space for commas and spaces between the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, just what do you expect to do with that data structure that you can't do with the current one?&lt;/P&gt;
&lt;P&gt;(It is sort of amazing how many times I get no answer to this question for basically the same data mangling)&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754340#M237861</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-07-15T14:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Concat the data in single cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754341#M237862</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Also, just what do you expect to do with that data structure that you can't do with the current one?&lt;/P&gt;
&lt;P&gt;(It is sort of amazing how many times I get no answer to this question for basically the same data mangling)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I feel the same way.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-the-data-in-single-cell/m-p/754341#M237862</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-15T14:27:57Z</dc:date>
    </item>
  </channel>
</rss>

