Proc Transpose can do that, but you will need to add a step to but in the 'N's for the missing values. data have ; input id template @@; dummy='Y'; cards4; 1 16 1 17 3 16 4 17 ;;;; proc transpose data=have out=want prefix=TempNum ; by id ; id template; var dummy ; run; data want ; set want ; drop _name_; array c TempNum: ; do over c; c=coalescec(c,'N'); end; run;
... View more