Hello,
I have a dataset that looks like this:
| year | orig | dest | flow |
| 1990 | AT | BE | 456 |
| 1990 | AT | DE | 356 |
| 1990 | AT | DE | 21 |
| 1990 | BE | DE | 235 |
I would like to sum the column "flow" when year, orig and dest have the same value. For instance, in that example, the dataset should become:
| year | orig | dest | flow |
| 1990 | AT | BE | 456 |
| 1990 | AT | DE | 377 |
| 1990 | BE | DE | 235 |
Is there a simple way to do this?
Post test data in the form of a datastep!
proc sql;
create table WANT as
select YEAR,
ORIG,
DEST,
sum(FLOW) as FLOW
from HAVE
group by YEAR,ORIG,DEST;
quit;
As a guess.
Post test data in the form of a datastep!
proc sql;
create table WANT as
select YEAR,
ORIG,
DEST,
sum(FLOW) as FLOW
from HAVE
group by YEAR,ORIG,DEST;
quit;
As a guess.
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!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.