BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
data_null__
Jade | Level 19

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

Capture.PNG

Emjay
Obsidian | Level 7

@novinosrin and @data_null__  Wow, thanks for your help guys! Very nice way.

novinosrin
Tourmaline | Level 20

@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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 17 replies
  • 2467 views
  • 5 likes
  • 5 in conversation