here is the transpose you are requesting:
data have;
input Cp_ID $
ID $
CONTENT $
ITEMCOUNT
LAST :date9. MODIFY $;
cards;
Cpid123. A2. One. 1864 20sep2018 17:54:02
Cpid123. A2. Two 20 20sep2018 17:36:09
Cpid123. A2. Five. 543 20sep2018 17:59:04
Cpid123. A2. Ten. 67 20sep2018 17:38:16
Cpid123. A2. One. 500 19sep2018 16:33:08
Cpid123. A2. Two 200 19sep2018 17:49:12
;
proc sort data=have;
by cp_id id last modify;
run;
proc transpose data=have out=want(drop=_name_);
by cp_id id last modify;
id content;
var itemcount;
format last date9.;
run;
proc print data=want;run;
a link to how to transpose data.
https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/
You can use the methods here to provide sample data in a format that others can easily use:
here is the transpose you are requesting:
data have;
input Cp_ID $
ID $
CONTENT $
ITEMCOUNT
LAST :date9. MODIFY $;
cards;
Cpid123. A2. One. 1864 20sep2018 17:54:02
Cpid123. A2. Two 20 20sep2018 17:36:09
Cpid123. A2. Five. 543 20sep2018 17:59:04
Cpid123. A2. Ten. 67 20sep2018 17:38:16
Cpid123. A2. One. 500 19sep2018 16:33:08
Cpid123. A2. Two 200 19sep2018 17:49:12
;
proc sort data=have;
by cp_id id last modify;
run;
proc transpose data=have out=want(drop=_name_);
by cp_id id last modify;
id content;
var itemcount;
format last date9.;
run;
proc print data=want;run;
Then make fake data or use a dataset from SASHELP.CLASS.
@Gil_ wrote:
Reeza i cant copy and post my actual code restrictions
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.