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;
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.
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.