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

I have the following dataset. I want to merge the amount of IID in the same day for each ID.

How to convert the data in the left into the data in the right? It does not matter for IID.

Thanks

  ID               Date         Volume   IID        Amount                  ID               Date            Volume   IID        Amount

1001      01/12/1980        50000    01         10000                 1001          01/12/1980        50000     ?         14200

1001      01/12/1980        50000    03          200                    1001          02/13/1980        55000     ?         14123

1001      01/12/1980        50000    02          4000        ==>     ....

1001      02/13/1980        55000    01         10009                  1009          01/12/1980        70000    ?         10200

1001      02/13/1980        55000    03          234                     1009          02/13/1980       79000     ?         10243

1001      02/13/1980        55000    02          3880

....

1009      01/12/1980        70000    01         10000

1009      01/12/1980        70000    03          200

1009      02/13/1980        79000    01         10009

1009      02/13/1980        79000    03          234

.....

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

proc sql;

   create table want as

   select id, date, volume, sum(amount) as amount

   from have

   group by id, date, volume

   ;

quit;

View solution in original post

1 REPLY 1
Patrick
Opal | Level 21

proc sql;

   create table want as

   select id, date, volume, sum(amount) as amount

   from have

   group by id, date, volume

   ;

quit;

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 823 views
  • 0 likes
  • 2 in conversation