Hello,
I am a new SAS user.
I have the following table:
| Company_ID | Share_ID | Price |
| 1001 | 01 | 10 |
| 1001 | 02 | 20 |
| 1001 | 03 | 30 |
| 1002 | 01 | 100 |
| 1003 | 06 | 20 |
| 1003 | 07 | 25 |
I want to add the rows by group and get the following output:
| Company_ID | Price |
| 1001 | 60 |
| 1002 | 100 |
| 1003 | 45 |
Thank you in advance for your kind support!
proc summary data=have nway;
class company_id;
var price;
output out=want sum=;
run;
Do want to add the rows to the existing dataset or just the summary rows in a new dataset?
proc summary data=have nway;
class company_id;
var price;
output out=want sum=;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.