<?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 concatenate multiple rows into one row in SAS DataFlux Data Management Studio ? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605726#M17268</link>
    <description>&lt;P&gt;There is so called 'Expression node'&amp;nbsp; but it uses its custom language (Expression Engine Language EEL).&lt;/P&gt;&lt;P&gt;Documentation of EEL is here:&lt;A href="https://support.sas.com/documentation/onlinedoc/dfdmstudio/2.3/dfU_ELRG.pdf" target="_blank"&gt;https://support.sas.com/documentation/onlinedoc/dfdmstudio/2.3/dfU_ELRG.pdf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 13:28:26 GMT</pubDate>
    <dc:creator>ondrejblasko</dc:creator>
    <dc:date>2019-11-20T13:28:26Z</dc:date>
    <item>
      <title>How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605665#M17241</link>
      <description>&lt;P&gt;Hello I am having trouble grouping/concentrating multiple rows into one in DataFlux using group column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My input data looks like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data INPUT
group	value
1	abc
1	def
2	ghi
2	jkl
2	mno
3	pqr&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I need to get result like this:&lt;/P&gt;&lt;PRE&gt;Data OUTPUT
group	value
1	abc, def
2	ghi, jkl, mno
3	pqr&lt;/PRE&gt;&lt;P&gt;I found many solutions for this situations for other SAS product, but I can't find one for SAS DataFlux.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking for group by and transpose + concentrate options, but i was unable to find the right one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions how to resolve this ?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 10:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605665#M17241</guid>
      <dc:creator>ondrejblasko</dc:creator>
      <dc:date>2019-11-20T10:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605671#M17243</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input group value $;
datalines;
1 abc
1 def
2 ghi
2 jkl
2 mno
3 pqr
;

data want(drop=value);
    do until (last.group);
        set have;
        length v $ 200;
        by group;
        v=catx(', ', v, value);
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;group  v
1      abc, def
2      ghi, jkl, mno
3      pqr&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605671#M17243</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-20T11:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605674#M17244</link>
      <description>&lt;P&gt;This is how I would do it in SAS code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input group value :$3.;
datalines;
1 abc
1 def
2 ghi
2 jkl
2 mno
3 pqr
;

/* determine the length needed for the concatenation */
proc sql noprint;
select max(count) * 4 - 1 into :length_needed
from (select count(*) as count length=3 from have group by group);
quit;

data want;
set have (rename=(value=_value));
by group;
length value $&amp;amp;length_needed.;
retain value;
if first.group
then value = _value;
else value = catx(',',value,_value);
if last.group;
drop _value;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:15:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605674#M17244</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T11:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605704#M17252</link>
      <description>&lt;P&gt;Another possibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Retrieve the max number of elements to be concatenated in a macrovariable &amp;amp;nbcol*/
proc sql;
	select max(frequency)
	into: nbcol
	from (select count(value) as frequency
		  from have
		  group by group);
quit;

data want;
	set have;

	/*Transpose all elements in as many columns as needed using an array*/
	array value_(&amp;amp;nbcol) $;

	by group;
	retain value_;
		
	if first.group then do;
			count=0;
			call missing(of value_(*));
		end;
	count+1;

	do i=1 to dim(value_);
		value_(count) = value;

	end;

	/*Concatenate elements in the same variable*/
	if last.group then do;
			value_cat = catx(', ',of value_(*));
			output;
		end;

	keep group value_cat;

run;

proc print data=want;
	id group;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605704#M17252</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-11-20T12:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605706#M17254</link>
      <description>&lt;P&gt;Thank You guys, but unfortunately I can't execute SAS code in&amp;nbsp;SAS DataFlux Data Management Studio (at least i don't know how yet).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605706#M17254</guid>
      <dc:creator>ondrejblasko</dc:creator>
      <dc:date>2019-11-20T12:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605709#M17257</link>
      <description>&lt;P&gt;I'm not a DI User, but isn't there a User Written Transformation?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605709#M17257</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T12:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605710#M17258</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input group value :$3.;
datalines;
1 abc
1 def
2 ghi
2 jkl
2 mno
3 pqr
;

proc transpose data=have out=temp(drop=_name_);
by group;
var value;
run;

data want;
set temp;
length value $100;
value=catx(', ',of col:);
drop col:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605710#M17258</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-11-20T12:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605726#M17268</link>
      <description>&lt;P&gt;There is so called 'Expression node'&amp;nbsp; but it uses its custom language (Expression Engine Language EEL).&lt;/P&gt;&lt;P&gt;Documentation of EEL is here:&lt;A href="https://support.sas.com/documentation/onlinedoc/dfdmstudio/2.3/dfU_ELRG.pdf" target="_blank"&gt;https://support.sas.com/documentation/onlinedoc/dfdmstudio/2.3/dfU_ELRG.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 13:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605726#M17268</guid>
      <dc:creator>ondrejblasko</dc:creator>
      <dc:date>2019-11-20T13:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate multiple rows into one row in SAS DataFlux Data Management Studio ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605812#M17298</link>
      <description>&lt;P&gt;You also might get an alternate approach if you can describe what advantages come from having multiple values in a single variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are also some details that may have been left out such as what is the result for :&lt;/P&gt;
&lt;PRE&gt;Data INPUT
group	value
1	abc
1	def
1      abc&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;Data INPUT
group	value
1	abc
1	def
1
2	ghi
2	jkl
2	mno
3	pqr&lt;/PRE&gt;
&lt;P&gt;And should there be any imposed order on the result such that if you have data like&lt;/P&gt;
&lt;PRE&gt;Data INPUT
group	value
1	abc
1	def
2	def
2	abc
2	mno
3	pqr&lt;/PRE&gt;
&lt;P&gt;Should the result for group 1 and group 2 be the same?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the number of potential values vary for each group as you use this process? What might happen when a new value is associated with group 1? Will any of the following processing need to change?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is convenience for a person to read then there may be a report solution that provides such without actually transforming data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-concatenate-multiple-rows-into-one-row-in-SAS-DataFlux/m-p/605812#M17298</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-20T15:56:03Z</dc:date>
    </item>
  </channel>
</rss>

