@novinosrin I think this is what you need.
data have;
input Year Name_ID Type $ Price Pieces;
datalines;
2017 1 Aa 100 .
2017 1 Bb 200 3
2016 2 Cc 80 4
2017 2 Cc 500 2
2018 1 Aa 30 11
2018 1 Bb 40 32
2018 2 Aa 50 5
2018 2 Cc 10 6
;
run;
proc sort data=have;
by name_id type year;
run;
proc print;
run;
proc summary data=have nway missing completetypes;
class type year;
output out=_have;
run;
data _have;
set _have have;
run;
proc transpose data=_have out=temp;
by name_id type year;
var price pieces;
run;
proc transpose data=temp out=want(drop=_: where=(not missing(name_id))) delimiter=_;
by name_id type;
id _name_ year;
run;
proc print;
run;
@novinosrin and @data_null__ Wow, thanks for your help guys! Very nice way.
@Emjay If I would pay somebody to read their content, Guru is right up there. Let me also add my thanks to yours.
@data_null__ Guru thankkkkkkkkkkkkkkkkkkkkkkkk youuuuuuuuuuuuuuuuuuuuuuuuuuuu!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! as always
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.