I have data that looks like the following as a data set in SAS (goes on for multiple years):
| Date | Dollar Amount |
| 07/14/2020 | 50 |
| 07/14/2020 | 20 |
| 07/14/2020 | 10 |
| 07/15/2020 | 30 |
| 07/15/2020 | 5 |
| 07/15/2020 | 67 |
I want to sum the dollar amount for each date to return one summed amount for each date in a new table that looks like the following:
| Date | Dollar Amount |
| 07/14/2020 | 80 |
| 07/15/2020 | 102 |
How do I create this new table?
data have;
input Date :mmddyy10. DollarAmount;
format Date mmddyy10.;
datalines;
07/14/2020 50
07/14/2020 20
07/14/2020 10
07/15/2020 30
07/15/2020 5
07/15/2020 67
;
proc summary data = have nway;
class Date;
var DollarAmount;
output out = want(drop = _:) 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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.