SAS SQL to aggregate rows -
I'm new to SAS and I create a column with data from each group of IDs with a large dataset I am working.
ID Name
1 AAA 1 AAA 1 BBB 2 CCC 2 CCC 2 AAA 3 DDD 3 BBB 3 AAA 4 BBB 4: A simplified version of my dataset looks like this And the result I am looking for is: ID name NEW_ID
1 AAA AAA, BBB1 AAA AAA, BBB 1 BBB AAA, BBB 2 CCC CCC, AAA 2 CCC CCC, AAA 2 AAA CCC, AAA 3 DDD DDD, BBB, AAA 3 BBB DDD, BBB AAA 3 AAA DDD, BBB, AAA 4 BBB BBB
Many of your help Remember Hanna is that ID can not always come in the form of a number. Thank you.
I can not think in a way to do this in the same data phase. But 2 is very easy to collect values first and then add them back to the main data set.
Data first; Is set; By ID; Format $ COL $ 2000; Maintaining Cal; If ^ last.id then col = col || Patti (name) || ""; Do more; Col = Patti (Colonel) || Strip (name); Output; End; Run; Want data; Merge is the first; By ID; Run;
Comments
Post a Comment