05-03-2017 02:34 PM - edited 05-03-2017 02:36 PM
Let's say I have this dateset:
DATA foo; input a b $; datalines; 1 apple 1 banana 1 orange 2 grape 2 kiwi 3 strawberry ;
And I want to concatenate b grouping by a using PROC SQL. Maybe something like this:
PROC SQL; select concatenate(b) from foo group by a; QUIT;
How would I go about doing that with PROC FCMP?
05-03-2017 02:40 PM
I'm sure one could torture PROC FCMP enough to create the function that you want. But because you want a function over several observations it will probably be very messy. Given your example, how about this data step, using the CATX function and a "SET ... BY" pair of statements inside a "do until last." loop?
input a b $10.;
do until (last.a);
length all_b_values $60;
05-03-2017 02:47 PM
05-03-2017 04:43 PM
Please vote for adding string aggregate functions to SAS/SQL at: