I have data with the columns
User_id (char)
filename (char)
filesize (numeric)
Every user_id has more than 5 files to it’s name, of different filesize values.
Problem statement: I want to have a summary of this table, with columns, User_id, Filesize, where it shows the total size occupied by each user id.
It tried Group By user id, in Proc SQL,
proc sql; CREATE TABLE want as SELECT user_id, filesize FROM have GROUP BY user_id; QUIT;
but it throws a warning that says
A GROUP BY clause has transformed into an ORDER BY clause because neither the SELECT clause nor the optional HAVING clause of the associated table-expression referenced a summary function.
Are there other ways to do this in SAS?
Advertisement
Answer
proc sql; CREATE TABLE want as SELECT user_id, SUM(filesize) as TotalFileSize FROM have GROUP BY user_id; QUIT;