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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 648 views
  • 0 likes
  • 2 in conversation