Warm tip: This article is reproduced from stackoverflow.com, please click
sas sql

put result in 1 cell, not in many

发布于 2020-04-16 12:05:11

I am using a basic select statement to pull some accounts. I need to output those accounts in a single cell, and not rows of accounts.

Questioner
Eyal Marom
Viewed
31
Niqua 2020-02-05 20:18
PROC SQL;
   CREATE TABLE WORK.WANT AS 
   SELECT /* Concatenated */
                     (cats(t1.COLUMN_1, ', ', t1.COLUMN_2)) AS ConcatenatedColumns
      FROM WORK.HAVE t1;
QUIT;

I guess you need to have concatenated results from some table?

cats() function can be used to concat values of different columns, with removed leading and trailing blanks.