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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 4649 views
  • 5 likes
  • 5 in conversation