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
.....
proc sql;
create table want as
select id, date, volume, sum(amount) as amount
from have
group by id, date, volume
;
quit;
proc sql;
create table want as
select id, date, volume, sum(amount) as amount
from have
group by id, date, volume
;
quit;
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.
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.