<?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 can I concatenate the data for each dept? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481230#M124449</link>
    <description>&lt;P&gt;It depends on what your next steps are.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jul 2018 19:08:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-07-25T19:08:35Z</dc:date>
    <item>
      <title>How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481210#M124440</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I concatenate the below data on the basis of unique dept with all the area in output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data abc;&lt;BR /&gt;input dept $ area $;&lt;BR /&gt;datalines;&lt;BR /&gt;D1 a&lt;BR /&gt;d1 b&lt;BR /&gt;d1 c&lt;BR /&gt;d2 s&lt;BR /&gt;d2 d&lt;BR /&gt;d2 f&lt;BR /&gt;d3 y&lt;BR /&gt;d4 r&lt;BR /&gt;d4 f&lt;BR /&gt;d4 t&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 18:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481210#M124440</guid>
      <dc:creator>vishalrajpoot3</dc:creator>
      <dc:date>2018-07-25T18:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481211#M124441</link>
      <description>&lt;P&gt;Please show us the desired result.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 18:08:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481211#M124441</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-25T18:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481213#M124442</link>
      <description>&lt;P&gt;something like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc;
input dept $ area $;
datalines;
D1 a
d1 b
d1 c
d2 s
d2 d
d2 f
d3 y
d4 r
d4 f
d4 t
;
run;

data want;
set abc;
by dept;
length new_var $30;
retain new_var;
if first.dept then call missing(new_var);
new_var=catx('-',new_var,area);
if last.dept;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jul 2018 18:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481213#M124442</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-25T18:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481220#M124444</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please see the below desired output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;dept&amp;nbsp; &amp;nbsp; area&lt;/STRONG&gt;&lt;BR /&gt;D1&amp;nbsp; &amp;nbsp; &amp;nbsp;a, b, c&lt;BR /&gt;d2&amp;nbsp; &amp;nbsp; &amp;nbsp;s, d, f&lt;BR /&gt;d3&amp;nbsp; &amp;nbsp; &amp;nbsp;y&lt;BR /&gt;d4&amp;nbsp; &amp;nbsp; &amp;nbsp;r, f, t&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 18:36:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481220#M124444</guid>
      <dc:creator>vishalrajpoot3</dc:creator>
      <dc:date>2018-07-25T18:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481222#M124445</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214824"&gt;@vishalrajpoot3&lt;/a&gt;&amp;nbsp; Modified my code to your requirement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
set abc;
_dept=upcase(dept);
run;
data want;
set temp;
by _dept;
length new_var $30;
retain new_var;
if first._dept then call missing(new_var);
new_var=catx(',',new_var,area);
if last._dept;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jul 2018 18:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481222#M124445</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-25T18:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481225#M124446</link>
      <description>&lt;P&gt;Thank you for showing us the desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are creating a report and you need the results as shown, then I guess&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;has given you the answer. However, if you are going to do additional analysis in SAS, this is a very poor way to structure the data for analysis, so I would advise against doing this in this case.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 18:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481225#M124446</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-25T18:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481228#M124447</link>
      <description>so what would you like to suggest doing in this case?</description>
      <pubDate>Wed, 25 Jul 2018 19:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481228#M124447</guid>
      <dc:creator>vishalrajpoot3</dc:creator>
      <dc:date>2018-07-25T19:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481230#M124449</link>
      <description>&lt;P&gt;It depends on what your next steps are.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 19:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481230#M124449</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-25T19:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I concatenate the data for each dept?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481233#M124450</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214824"&gt;@vishalrajpoot3&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;so what would you like to suggest doing in this case?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Very simple. Don't do it. Longitudinal datasets are always better for analysis. Wide formats are only needed for presentations to PHBs.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 19:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-concatenate-the-data-for-each-dept/m-p/481233#M124450</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-25T19:09:38Z</dc:date>
    </item>
  </channel>
</rss>

