Given the following data,
data tmp;
input class $ age gpa graduated;
datalines;
A 16 2.47 1
B 13 3.65 1
A 13 2.04 0
B 12 2.3 0
C 15 3.58 1
;
run;
I'm seeking this output:
class|unique_ages
A|13, 16
B|12, 13
C|15
Coming from the world of Hive/Apache Spark, functions like collect_set
+ concat_ws
have worked well, but I haven't found the equivalent in SAS.
PROC SQL;
SELECT
class
* some grouping function on `age`;
FROM tmp
GROUP BY class
;
QUIT;
Similar answers look like this: Can I Comma Delimit Multiple Rows Into One Column? [duplicate]. Group-by row aggregation and concatenation.