BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Demographer
Pyrite | Level 9

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?

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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. 

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2832 views
  • 1 like
  • 2 in conversation